Examveda
Examveda

What will be the output of the following C code?
#include <stdio.h>
int *f();
int main()
{
    int *p = f();
    printf("%d\n", *p);
}
int *f()
{
    int j = 10;
    return &j;
}

A. 10

B. Compile time error

C. Segmentation fault/runtime crash

D. Undefined behaviour

Answer: Option A


This Question Belongs to C Program >> Pointer

Join The Discussion

Related Questions on Pointer