0
what syntax will i use?
i dont know how to create an array with syntax and to inherent it. ,
2 Answers
+ 1
datatype arrayName[ ]={element1,..., elementn};
example:
int arraySample [ ] = {1,3,2,77,9};
To call the element just type:
arraySample[x];
which x is number of element start with 0.
0
Here's another way to declare an array.
datatype [] array_name = new datatype [array_size];
This creates an array of the specified datatype and with a maximum size specified by the array_size.