answersLogoWhite

0

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

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

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};.


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.


What is the requirement of an array?

The two main requirements of an array are: * Its size should be specified while declaration. This size cannot change. * It can contain only homogeneous elements as its values. i.e., for example an array can contain either all int values or all char values etc. It cannot take values of different data types


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 ......


Which Array tasks are recommended when replacing a hard drive?

Initialize and remove dead segments


Summarize the ruls for writing a one dimessional array definetion?

To define a one-dimensional array in programming, you typically specify the type of elements the array will hold, followed by the name of the array, and the size of the array in square brackets. For example, in languages like C or Java, you would write int myArray[10]; to declare an array named myArray that can hold 10 integers. Additionally, it's important to initialize the array if needed, either at the time of declaration or later in the code. Remember that array indexing usually starts at zero.


How arrays are created in java?

Arrays are created just like other variables in Java. Ex: int[] a; // declares an array of integers a = new int[10]; // allocates memory for 10 integers a[0] = 100; // initialize first element a[1] = 200; // initialize second element Arrays are homogenous data types and hence they can contain values of only one type. If you create an integer array it can hold only integer data type values. If you try to assign values to nonexistent locations like a[15] it will throw an index out of bounds exception.


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 difference between numeric array and associative array?

Numeric array has numbers(+integers) that represent the values Associative array has strings that represent the values


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.


Declare and initialize 2D array in java using two statements- one to declare variable the other to initialize elements?

I'm not sure what you're asking. Do you mean when you declare/instantiate an array like this? int[][] arr; arr = {{1, 2, 3},{4, 5, 6}}; I think that's right. *********************************** THIS IS INCORRECT because you can assign constant values to array only at time of initialization. Therefore above code will throw an error. Correct way is: int[][] arr = {{1, 2, 3},{4, 5, 6}}; thanx .. itsabhinav123@gmail.com