Write program to display address of each element in the array along with its value
You should see that each address is separated by 4 bytes.
#include <stdio.h> int main()//from w ww .j av a2 s.co m { int numbers[10]; int x; int *pn; pn = numbers; /* initialize pointer */ /* Fill array */ for(x=0;x<10;x++) { *pn=x+1; pn++; } pn = numbers; /* Display array */ for(x=0;x<10;x++) { printf("numbers[%d] = %d, address %p\n", x+1,numbers[x],pn); pn++; } return(0); }