What will be the output of the following C code? [code] #include <stdio.h> typedef struct p *q; struct p { int

What will be the output of the following C code?
Code:
    #include <stdio.h>
    typedef struct p *q;
    struct p
    {
        int x;
        char y;
        q ptr;
    };
    int main()
    {
        struct p p = {1, 2, &p};
        printf("%d\n", p.ptr->ptr->x);
        return 0;
    }
A. Compile time error
B. Segmenation fault
C. Undefined behaviour
D. 1
 

Tìm kiếm

Back
Top