+ 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}}

19th Oct 2016, 4:17 PM
Onkar Ashok Gumate
Onkar Ashok Gumate - avatar
2 Answers
+ 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
19th Oct 2016, 4:51 PM
Jumar Alam
Jumar Alam - avatar
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}}
28th Jan 2017, 6:21 PM
Arnab Paul Choudhury
Arnab Paul Choudhury - avatar