Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- pointers.c
- You can find all my C programs at Dragan Milicev's pastebin:
- https://pastebin.com/u/dmilicev
- */
- #include <stdio.h>
- int main(void){
- int x, y;
- int *px, *py;
- x = 10;
- y = 20;
- px = &x;
- py = &y;
- printf("\n Address of x variable: %p \n", &x);
- printf("\n Address of y variable: %p \n\n", &y);
- printf("\n Address stored in px variable: %p \n", px);
- printf("\n Address stored in py variable: %p \n\n", py);
- printf("\n Address of x variable: %x \n", &x);
- printf("\n Address of y variable: %x \n\n", &y);
- printf("\n Address stored in px variable: %x \n", px);
- printf("\n Address stored in py variable: %x \n\n", py);
- printf("\n Value of px variable: %d \n", *px);
- printf("\n Value of py variable: %d \n\n", *py);
- printf("\n\n");
- return 0;
- } // main()
- /*
- Sample output:
- Address of x variable: 0022FF14
- Address of y variable: 0022FF10
- Address stored in px variable: 0022FF14
- Address stored in py variable: 0022FF10
- Address of x variable: 22ff14
- Address of y variable: 22ff10
- Address stored in px variable: 22ff14
- Address stored in py variable: 22ff10
- Value of px variable: 10
- Value of py variable: 20
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement