Machine-translated by Google. Questions are authored in English.
Top

Discussion

What will be the output of the following C code?

main()
{
    enum resut {pass, fail};
    enum result s1,s2;
    s1=pass;
    s2=fail;
    printf("%d",s1);
}

 

  • A.error
  • B.pass
  • C.fail

Answer: A

Correct answer: error

The enumeration is declared as enum resut - a typo - and the variables are then declared as enum result, a tag that does not exist. The compiler reports an incomplete type.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.