Given the following code:
#include <stdio.h>
int main()
{
int *p;
p = (int *)malloc(10 * sizeof(int));
while(1);
return 0;
}
When the above code is compiled and run, and is interrupted while in execution by pressing Ctrl+C, how is the memory allocated to p
freed? What is the role of the Operating System here? And how is it different from that in case Of C++, done using the new
operator?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…