Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- content_of_an_address_v1.c
- Task from Sunshine S
- https://web.facebook.com/sunshines13
- https://web.facebook.com/groups/543431102664524/?post_id=1174495746224720&comment_id=1174746769532951&reply_comment_id=1175294896144805¬if_id=1591153540531865¬if_t=group_comment&ref=notif
- What is the command if I want to see content of an address?
- Say, I want to see the content of FFFF?
- You must know what type of variable is on that address. If it is int then
- int *ip=FFFF;
- printf("%d", *ip);
- But, you cant read all memory. Read this
- https://gribblelab.org/CBootCamp/7_Memory_Stack_vs_Heap.html
- https://stackoverflow.com/questions/32914298/print-value-and-address-of-pointer-defined-in-function
- You can find all my C programs at Dragan Milicev's pastebin:
- https://pastebin.com/u/dmilicev
- */
- #include <stdio.h>
- int main(void)
- {
- int n = 5;
- int *pn;
- pn = &n;
- printf("\n On hexadecimal address %p is value n = %d \n", (void *)pn, *pn );
- printf("\n On decimal address %d is value n = %d \n", (void *)pn, *pn );
- pn = (void *)0x0022FF18; // here write hexadecimal address which is on your screen
- printf("\n On hexadecimal address %p is value n = %d \n", (void *)pn, *pn );
- pn = (void *)2293528; // here write decimal address which is on your screen
- printf("\n On decimal address %d is value n = %d \n", (void *)pn, *pn );
- return 0;
- } // main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement