Home » C Programming » Functions » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    enum color{Red, Yellow, Green};
    enum color fun();
    int main()
    {
    enum color n = fun();
    printf("%d\n", n);
    }
    int fun()
    {
    return Red;
    }
    1. Red
    2. Yellow
    3. Green
    4. Compilation Error
    5. None of these
Correct Option: D

Compilation Error

main.c:9:10: error: conflicting types for ‘fun’
int fun()
^~~
main.c:3:16: note: previous declaration of ‘fun’ was here
enum color fun();



Your comments will be displayed only after manual approval.