Guest User

Untitled

a guest
Feb 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. // pointee
  6. int x;
  7. x = 5;
  8. printf("%p\n", &x);
  9.  
  10. // pointer
  11. //
  12. //
  13. // pointer to float
  14. // float* x;
  15. // pointer to integer
  16. int* xPtr;
  17. xPtr = &x;
  18. printf("%p\n", xPtr);
  19.  
  20.  
  21.  
  22. // value manipulation
  23. // dereferencing operator (go to that address where xPtr points to, and access/manipulate value there)
  24. *xPtr = 25;
  25. printf("x = %d\n", x);
  26.  
  27.  
  28. int** pointerToxPtr = &xPtr;
  29. **pointerToxPtr = 100;
  30. printf("x = %d\n", x);
  31.  
  32. }
  33.  
  34. /* // 3 integers */
  35. /* int x, y, z; */
  36. /* int x; */
  37. /* int y; */
  38. /* int z; */
  39. /* */
  40. /* // 1 pinter others integers */
  41. /* int* x, y, z; */
  42. /* int* x; */
  43. /* int y; */
  44. /* int z; */
  45. /* */
  46. /* // 3 pointers to integer */
  47. /* // type declaration */
  48. /* int* x, *y, *z; */
  49. /* */
Add Comment
Please, Sign In to add comment