answersLogoWhite

0

How you initialize an array?

User Avatar

Anonymous

16y ago
Updated: 8/17/2019

by elements, like:

int arr [3] = {1, 2, 3};

or even: int arr [] = {1, 2, 3};

character-arrays can be initialized with strings, like: char hellostr [] = "Hello";

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

How does one initialize a byte array in Java?

One can get information about how to initialize a byte array in java on the website stackoverflow dot com. That website can learn one a lot about java.


Which condition is not necessary in dynamic stack?

in dynamic stack we don't have to initialize the size of array while in static stack we have 2 initialize it ......


How you can initialize an array with data values during declaration?

int myArray[] = {1,2,3,4,5};


Which Array tasks are recommended when replacing a hard drive?

Initialize and remove dead segments


How do you initialize an array at compile time in c?

In C, you can initialize an array at compile time by specifying its elements within curly braces during declaration. For example, you can declare and initialize an integer array like this: int arr[] = {1, 2, 3, 4, 5};. The size of the array can be omitted, and the compiler will automatically deduce its size based on the number of elements provided. Additionally, you can specify the size explicitly, such as int arr[5] = {1, 2, 3, 4, 5};.


Why can't we increment an array like a pointer?

once we initialize the array variable, the pointer points base address only & it's fixed and constant pointer


What is the default value of the array elements in an integer array?

'0' Try this: public static void main(String[] args){ } The output would be 0 even though you did not initialize any value in the int array.


What is Jagged Array in C?

A Jagged array is an array of arrays. You can initialize a jagged array as − int[][] scores = new int[2][]{new int[]{92,93,94},new int[]{85,66,87,88}}; Where, scores is an array of two arrays of integers - scores[0] is an array of 3 integers and scores[1] is an array of 4 integers.


How jagged array can be initialized using indexer?

A jagged array, which is an array of arrays, can be initialized using indexers in C# by first declaring the array and then specifying the size of each sub-array. For example, you can create a jagged array like this: int[][] jaggedArray = new int[3][];, and then initialize each sub-array individually, such as jaggedArray[0] = new int[2]; and jaggedArray[1] = new int[3];. You can also initialize it inline, like int[][] jaggedArray = new int[][] { new int[2], new int[3], new int[1] };. This allows for flexible sizing of each inner array.


How do you set the null value in array?

Depends on the programming language, some languages may have already initialize an array with null (or the default value of the type), some of them require explicitly assignments by stepping through each element of that array, and assigning them with null. (imperative languages)


How do you use arrays in biginteger?

In Java, you would create an array of type BigInteger, then initialize each object (each array element) with the newoperator. I believe it would be something like this: BigInteger[] myArray = new BigInteger[5]; for (int i = 0; i


Does this correctly create an array of 5 elementsint 5 myArray new int?

The syntax provided is incorrect for creating an array of 5 elements in most programming languages. In Java, for example, you would declare and initialize the array as follows: int[] myArray = new int[5];. This creates an array named myArray that can hold 5 integer elements.