What will be the output of the following C code?
#include <stdio.h>
typedef struct p *q;
int main()
{
struct p
{
int x;
char y;
q ptr;
};
struct p p = {1, 2, &p};
printf("%d\n", p.ptr->x);
return 0;
}
#include <stdio.h>
typedef struct p *q;
int main()
{
struct p
{
int x;
char y;
q ptr;
};
struct p p = {1, 2, &p};
printf("%d\n", p.ptr->x);
return 0;
}A. Compile time error
B. 1
C. Depends on the compiler
D. None of the mentioned
Answer: Option A
Related Questions on Structure and Union
Which of the following can be a member of a structure?
A. Function
B. Another structure
C. Enumeration
D. All of the above

Join The Discussion