Home » C Programming » Structures » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    struct Employee
    {
    int id;
    char Name[26];
    };
    struct Employee emp;
    id = 1001;
    printf("%d", id);
    }
    1. Garbage value
    2. Nothing
    3. Compilation Error
    4. 1001
    5. None of these
Correct Option: C

Compilation Error

main.c: In function ‘main’:
main.c:10:9: error: ‘id’ undeclared (first use in this function); did you mean ‘void’?
id = 1001;
^~
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.