My professor’s final exam mostly consisted of very tricky syntax. For example, some of his questions were like "use pointer 1 to print out the letter k without using brackets. Luckily it was open book.
So one question was:
int a[2][2][2] = {{5,6}, {7,8}, {9,10}, {11,12}};
write a printf statement that will print out "7910". Using pointers without using square brackets.
At first, I thought this was a typo or an illegal array. I thought the array is supposed to stop at the third array from the left.
I wrote:
printf("%d%d%d\n",*(*(a+1)+1)),*(*(a+2)),*(*(a+2)));
I put this because if the array was
int a[2][2] = {{7,8},{11,12}};
a syntax similar would work.
So was this a typo? If not, what is the right syntax?