C 13
Pointer Guest on 5th April 2021 12:53:31 AM
  1. #include<stdio.h>
  2. int main()
  3. {
  4.   int x = 10, *ptr, **pptr;
  5.   ptr = &x;
  6.   pptr = &ptr;
  7.  
  8.   printf("Value of x is %d\n", x);
  9.   printf("Address of x in Hex is %p\n",&x);
  10.  
  11.   printf("Address of x in long unsigned int decimal is %lu\n",(unsigned long int) &x);
  12.   printf("Value of pointer variable ptr is %p (address in Hex)\n", ptr);
  13.  
  14.   printf("Address of pointer variable ptr is %lu\n", (unsigned long int)&ptr);
  15.   printf("The value at location pointed by Ptr is %d\n",*ptr);
  16.  
  17.   printf("Address of pointer variable pptr is %lu\n", (unsigned long int)&pptr);
  18.   printf("The value at loation pointed by pointer variable pptr is %lu\n", (unsigned long int) *pptr);
  19.   printf("The value at located pointed by pptr is %d  or %d\n", **pptr, *(*pptr));
  20.  
  21.   return 0;
  22.  
  23. }

Paste-bin is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.