Examveda

What will be the output of the following C code?
#include <stdio.h>
struct p
{
    int x;
    char y;
    struct p *ptr;
};
int main()
{
    struct p p = {1, 2, &p};
    printf("%d\n", p.ptr->x);
    return 0;
}

A. Compile time error

B. Undefined behaviour

C. 1

D. 2

Answer: Option C


This Question Belongs to C Program >> Structure And Union

Join The Discussion

Related Questions on Structure and Union