in Programming in C edited by
1,506 views
3 votes
3 votes

Output of the following program?

#include<stdio.h>
struct st 
{ 
    int x; 
    struct st next; 
}; 
int main() 
{ 
    struct st temp; 
    temp.x=10; 
    temp.next=temp;
    printf("%d",temp.next,x); 
    return 0; 
}
  1. Compiler Error
  2. $10$
  3. Runtime Error
  4. Garbage Value
in Programming in C edited by
by
1.5k views

2 Answers

1 vote
1 vote
COMPILER ERROR , Here compiler doesnt found exact type of next, it behaves like recursion
1 vote
1 vote
struct st next;

This should be a pointer to a struct. A Struct object cannot be inside the struct definition. So this compiler error will be detected first. 

 

Answer:

Related questions