I want to initalize a 3 x 3 matrix with first two rows as 0’s and last row as 1’s. I have declared a 2D array int matrix[3][3]
I want to initialize it without using loops as shown below
0 0 0
0 0 0
1 1 1
I would also like a solution for N dimiensional array
Or, the more compact:
The solution generalizes for
Nso long asNis fixed. IfNis large, you can use mouviciel’s answer to this question.