declaration and initialisation of the array of the arrays

Please, what is the right decalration and initialisation of the array of more int arrays?

Many thanks!!!


array aaa[3]={a1[4], a2[2], a3[1]}?
Use 2D arrays:
1
2
3
4
int ARR[3][4] = { {1, 2, 3, 4},
		  {5, 6},
		  {7, 8, 9, 10},
		};
Hello!
Thanks, but still not got it properly!
What (sub)arraya are in that ARR array?
How many elements has ARR?

what are elements from particular (sub)array?

MANY THANKS!
ARR[3][4] declares 3 integer arrays of 4 integers each.

enemy wrote:
Thanks, but still not got it properly!

What exactly are you trying to do?

EDIT:

Imagine 2D arrays as follows:
1
2
3
4
5
6
7
8
9
10
int arr1[4] = {1, 2, 3, 4};
int arr2[4] = {5, 6};
int arr3[4] = {7, 8, 9};
//can be written as an array of array as:
int ARR[3][4] = { arr1, arr2, arr3 };
//which is basically same as:
int ARR[3][4] = { {1, 2, 3, 4},
		  {5, 6},
		  {7, 8, 9},
		};
Last edited on
Hello!
THANKS!
Is second array's index 2 or 4?
(U said 4 integers each!)-> that is confusing me!

Many thanks!
Topic archived. No new replies allowed.