Home » C Programming » Typedef » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    typedef struct Employee
    {
    char *ch;
    }Employ;
    void main()
    {
    Employ emp;
    emp.ch = "Hello";
    printf("%s", emp.ch);
    }emp
    1. Hello
    2. Garbage value
    3. Compilation Error
    4. All of above
    5. None of these
Correct Option: C

Compilation Error

main.c:11:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ at end of input
}emp



Your comments will be displayed only after manual approval.