What is the output of following C program? (MCQ) #include<stdio.h> int * fun()…

What is the output of following C program? (MCQ)

#include<stdio.h>

int * fun()

{

int q = 10;

int *p;

p = &q;

return p;

}    

int main()

{

int *res;

res= fun();

printf("%d", *res);

return 0;

}

  1. A.

    Undefined behaviour

  2. B.

    10

  3. C.

    Compile error

  4. D.

    Run time error

Attempted by 492 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…