In C
name of the array indicates the base address of the array, so all of your ring1
, ring2
and ring3
gives the address of their starting element (i.e 0th).
Similarly rings
is also an array (Its a 2 Dimensional array).
We cannot store address in arrays, for that will have to use pointers.
So we have to use below way.
#include <stdio.h>
int main()
{
int ring1[5] = {1,2,3,4,5};
int ring2[5] = {6,7,8,9,10};
int ring3[5] = {11,12,13,14,15};
//int rings[3][5] = {{ring1}, {ring2}, {ring3}};
int *rings[3] = {ring1, ring2, ring3};
printf("ring1 = %p and rings[0] =%p\n", ring1, rings[0]);
printf("ring2 = %p and rings[1] =%p\n", ring1, rings[1]);
printf("ring3 = %p and rings[2] =%p\n", ring1, rings[2]);
return 0;
}