adplus-dvertising
frame-decoration

Question

What is the output of this program?
#include <stdio.h>
#include  <stdlib.h>
int main()
{
   int *j = (int*)malloc(4 * sizeof(int));
   *j = 15;
   free(j);
   printf("%d", *j);
   return 0;
}

a.

Compilation error

b.

Some Garbage value

c.

0

d.

Nothing prints

Posted under C Programming

Answer: (b).Some Garbage value

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?