I'm trying to print the array index using pointers arithmetic. Does anyone have any idea how to do it? in particular "j" I would like you to do it.
#include <stdio.h>
int main(void) {
int b[10] = {2, 8, 4, 7, 1, -45, 120, 78, 90, -6};
int *pb, j = 0;
for(pb = &b[0]; pb < &b[10];) {
printf("[%d] = %d\n", j, *pb++);
}
return 0;
}
j++in the loop