Declare integer variable m
Declare integer pointer variable ab
Assign 29 to m
Print the address of m and its value
Print the address of ab and the content it points to
Assign the address of m to ab
Print the address of ab and the content it points to
Assign 34 to m
Print the address of ab and the content it points to
Assign 7 to the content of ab
Print the value of m
#include <stdio.h>
int main()
{
//! showMemory()
int* ab;
int m;
m=29;
printf(" Address of m : %p\n",&m);
printf(" Value of m : %d\n\n",m);
ab=&m;
printf(" Address of pointer ab : %p\n",ab);
printf(" Content of pointer ab : %d\n\n",*ab);
m=34;
printf(" Address of pointer ab : %p\n",ab);
printf(" Content of pointer ab : %d\n\n",*ab);
*ab=7;
printf(" Value of m : %d\n\n",m);
return 0;
}
Address of m : 0x7ffeeed0d9ec
Value of m : 29
Address of pointer ab : 0x7ffeeed0d9ec
Content of pointer ab : 29
Address of pointer ab : 0x7ffeeed0d9ec
Content of pointer ab : 34
Value of m : 7
I am Md. Anisur Rahman. I have completed Cyber Security for MSCSE at United International University in 2022.I have completed PGDIT from IIT, Jahangirnagar University in 2020. I'm a Head of IT at Programming24 School.
View all posts by Md. Anisur Rahman