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

Discussion

What is the output of this C code?

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

 

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

Answer: A

Correct answer: hi

m is defined before main, so it is already declared when the call is reached, and it simply prints hi. (void main() is non-standard, but every compiler accepts it.)

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

Post your comment

Please log in or register to post a comment.