Answer:
The Pointer P becomes a dangling pointer.
Explanation:
int calculate(){
int *p = (int*)malloc(10);
*p = 10;
return p;
}
In this program, the scope of p is only with the calculate function block. Hence, once the compiler comes out of the function, it can no more access the pointer p or the memory location p is pointing to. To overcome the dangling pointer, we need to declare p as static, so that the scope of p is throughout the program.