Question: #include #include #include int main ( int argc, char * argv [ ] ) { int i = 0 ; int * p = malloc
#include
#include
#include
int mainint argc, char argv
int i ;
int p mallocsizeofint;
if argc
printfusage: mem
;
exit;
printfd addr pointed to by p: p
int getpid p;
p atoiargv;
fori; i; i
sleep;
p p ;
printfd value of p: d
int getpidp;
freep;
return ;
Compile and run it with the following command:
gcc vmc && aout
Let's say we get the following output:
addr pointed to by p: x
value of p:
value of p:
value of p:
value of p:
value of p:
Which section of the virtual memory space of this programprocess is used to store the printedout value xNote that p is a local variable of integer pointer data type.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
