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

Discussion

What is the output of this C code?

void main()
    {
        m();
        void m()
        {
            printf("hi");
        }
    }

 

  • A.hi
  • B.Compile time error
  • C.Nothing
  • D.Varies

Answer: B

Correct answer: Compile time error

m is defined inside main, which standard C forbids - and it is also called before its definition is reached. The compiler rejects the program.

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

Post your comment

Please log in or register to post a comment.