Declaring an array
char a[10][20] = {...}
I can’t find the right way to create a pointer x so that a[1][3], for example, is x[1][3].
I tried:
// try 1
char * x; x = &a[0][0];
// try 2
char * x; x = a;
// try 3
char ** x; x = a;
// try 4
char ** x; x = &a[0][0];
How do I work this out?
You can say
char (*p)[20] = a;, which makespinto a pointer to an array of 20 chars. This means that++pleaps to the next slice of 20, and you have 10 of those slices (each denoted by the expressionp[i], where 0 ≤ i < 10.