Look at the addresses of each array element

Chapter 11

 

#include<stdio.h>

// program to show pointer address in an array

 

int main()

{

int num[5]={223,305,470,534,6};

int *ptnum, i=0;

ptnum=num;

printf("The starting address of the array is %p\n",num);

printf("\nPosition\tValue\tAddress");

while(ptnum<num+5)

{

            printf("\n%d\t\t%d\t%p\n",i,num[i],ptnum++);

            i++;

}

return 0;

}

 

 

Return to 1336 home page