- Array Declaration:
int myArray[];
int[] myArray;
You can simply declare the array using above example. Here myArray[] object is just declared, no memory allocated nor the values are initialized. you can say like the name myArray is declared as Array.
- Array memory allocation:
int myArray[] = new int[10];
Using the above example you can allocate the memory to an array. Here we are allocating 10 integer values to myArray[] so that the array myArray[] can store up to 10 integer values.
- Array Initialization:
int myArray[] = {1,2,3,4,5,6,7,8,9,10};
Using the above example you can initialize the values, here myArray[] contains 10 values where myArray[1]=2;