Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- int main(void)
- {
- int a = 100;
- /*
- * ---------------------
- * | Memory address = &a|
- * ---------------------
- * | a = 100 |
- * ---------------------
- * */
- int *ptr = &a;
- /*
- * ---------------------------
- * | Memory address = ptr = &a |
- ---------------------------
- | *ptr = a = 100 |
- ---------------------------
- */
- // To print the VALUE at the MEMORY ADDRESS
- printf("*ptr = %d\n", *ptr);
- // To Print the MEMORY ADDRESS itself
- printf("ptr = %p\n", (void *) ptr);
- printf("&a = %p\n", &a);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement