Home » C Programming » Pointers » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    struct Employee
    {
    int id = 5;
    char emp_name[23];
    };
    void main()
    {
    struct Employee Emp;
    Emp.id = 102;
    printf("Interview Mania");
    }
    1. Interview Mania
    2. Garbage value
    3. Compilation Error
    4. 102
    5. None of these
Correct Option: C

Compilation Error

main.c:4:16: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘=’ token
int id = 5;
^
main.c: In function ‘main’:
main.c:10:12: error: ‘struct Employee’ has no member named ‘id’
Emp.id = 102;
^



Your comments will be displayed only after manual approval.