// Explain the output of this code,specifically can't understand the last printf output...Please explain
void print(int *a)
printf("%d",a); // outputs 8
printf("%d",*a); //outputs -21
printf("%d",*++a); //outputs 7
printf("%d",*(++a)); //outputs 23
printf("%d",a[-1][+1]); /*outputs 8 explain?*/
Remember that a is a pointer to a pointer and may be changed, it isn't the same object as the array x, it merely points to the first element of that array. The same holds for the elements of array x, they are just pointers to arrays a1, a2, a3.
Before the last printf line, the pointer a points to the second element of the array x, which is a pointer to the array a2. The cause for this is the fourth printf line which incremented the pointer a by one.
Then we step into the last printf line.
The first subscript
[-1] decrements the pointer a, the result now points to the first element of the array x, which is a pointer to the array a1. The dereference gives the value of that pointer. Because of the third printf line, this pointer points to the second element of the array a1.
The second subscript
 retrieves the the third element of array a1.