Advertisement
Devian

C_Pointer

Aug 14th, 2014
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. /*   %X = shows up in hexadecimal.
  2.      &i = shows its address in the memory.
  3.      by: Devian
  4. */
  5. #include<stdio.h>
  6. #include<stdlib.h>
  7. int main()
  8. {
  9.     int i = 5, *p;
  10.    
  11.     p = &i; // p now has the address of &i as value alocated.
  12.    
  13.     printf("\nADDRESS of i : %X\n",&i); //prints its address.
  14.     printf("\nValue which i has: %d",i);// its value.
  15.     printf("\n\n\p receives i ADDRESS p = %X",p);// prints the address from &i, "p = &i;" . and its value.
  16.     printf("\n\np points to value of i,which is: *p : %d",*p);// p points to i = 5,and shows i's value.
  17.        
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement