+ 2
can we write multi dimensional array like int arr[][] ={1,2,3,4,5,6} instead of int arr[][] ={{1,2,3},{4,5,6}}
2 odpowiedzi
+ 1
No we can't. We always have to insert curly braces before and after of the elements.
for example:
int arr[][]={{1,2,3,4,5,6}};
and one more thing.This array will considered as an One-D array.
if you want to use it as multi dimensional array then you have to assign the elements of the array later in the code
0
By multi dimensional array there has to be at least two set of arrays between curly braces like this..
{{2,3,4},{5,6}}.. or {{1,7,9,5}}