C program on pointers

 Program:

#include <stdio.h>
int main()
{
    int i=100,*j,**k;
    j=&i;
    k=&j;
    printf("value at i=%d\n",i);
    printf("address of i=%u\n",&i);
    printf("address of i=%u\n",j);
    printf("value at i=%d\n",*j);
    printf("address of j=%u\n",&j);
    printf("value at i=%d\n",**k);
    printf("address of i=%u\n",*k);
    printf("address of j=%u\n",k);
    printf("address of k=%u\n",&k);
    return 0;
}

Output: 

value at i=100
address of i=6356748
address of i=6356748
value at i=100
address of j=6356744
value at i=100
address of i=6356748
address of j=6356744
address of k=6356740

Note: The address may be different from the above output. The variables may be assigned with other address. 

Popular Posts