1.

What will be the output of the following C code?#include <stdio.h> int *fun(); int main() { int *ptr = fun(); printf("%d n", *ptr); } int *fun() { int *p = (int*)malloc(sizeof(int)); *p = 11; return p; }

A. Compilation Error
B. 11
C. Undefined behaviour
D. Segmentation fault/runtime crash since pointer to local variable is returned
E. None of these
Answer» C. Undefined behaviour


Discussion

No Comment Found