What is the output for the following code snippet? #include <stdio.h> struct…

What is the output for the following code snippet? #include <stdio.h> struct emp { int age; struct emp *ptr; }; int main(){ struct emp var={24,NULL}; struct emp *ptr = &var; ptr->ptr = ptr; printf("%d %d", ptr->age,ptr->ptr->ptr->age); }

  1. A.

    24 24

  2. B.

    0 0

  3. C.

    NULL NULL

  4. D.

    Undefined behaviour (Runtime error)

Sign up free to check your answer

Sign up free

Explore the full course: C Language

Loading lesson…