Examveda

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

A. 11 11

B. Undefined behaviour

C. Compile time error

D. Segmentation fault/code-crash

Answer: Option A


This Question Belongs to C Program >> Pointer

Join The Discussion

Related Questions on Pointer