The following program gives output as 17,29,45; I can't understand what does **++pp;
mean. Can anyone explain the program in detail.
#include <stdio.h>
int main() {
static int a[] = {10, 22, 17, 29, 45};
static int *p[] = {a, a + 2, a + 1, a + 4, a + 3};
int **pp = p;
**++pp;
printf("%d %d %d", **pp, *pp[3], pp[0][2]);
}
In your code, **++pp;
is the same as * (* ( ++pp));
. It first increments the pointer, then deferences twice (the first dereference result is of pointer type, to be elaborate).
However, the value obtained by dereferencing is not used. If you have compiler warnings enabled, you'll get to see something like
warning: value computed is not used
You can remove the dereferencing, it's no use.