Question: What is the problem with following code? A. Memory Leakage B. Dangling pointer C. Compiler error D. None of the the above #include #include void

What is the problem with following code?

#include #include void fun () { int *ptr = (int *) malloc

A. Memory Leakage 

B. Dangling pointer 

C. Compiler error 

D. None of the the above

#include #include void fun () { int *ptr = (int *) malloc (sizeof (int)); printf(" Memory allocated dynamically for integer variable"); } int main () { fun(); return 0; }

Step by Step Solution

3.45 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

A Explanation The problem is memory l... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Data Structures and Other Objects Using Java Questions!