Home » C Programming » Pointers » Question
  1. What will be the output of the following C code?
     #include <stdio.h>
    void main()
    {
    struct Employee
    {
    int id;
    char emp_name[30];
    };
    struct Employee Emp;
    id = 101;
    printf("%d", id);
    }
    1. Garbage value
    2. Compilation Error
    3. Nothing
    4. Null
    5. 101
Correct Option: B

Compilation Error

main.c: In function ‘main’:
main.c:10:9: error: ‘id’ undeclared (first use in this function); did you mean ‘void’?
id = 101;
^~
void
main.c:10:9: note: each undeclared identifier is reported only once for each function it appears in



Your comments will be displayed only after manual approval.