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

Discussion

What is the scope of a function?

  • A.Whole source file in which it is defined
  • B.From the point of declaration to the end of the file in which it is defined
  • C.Any source file in a program
  • D.From the point of declaration to the end of the file being compiled

Answer: D

Correct answer: From the point of declaration to the end of the file being compiled

A function’s name is in scope from its declaration to the end of the file - which is exactly why prototypes are put at the top or in a header. Its linkage is external, so other files can call it once they have declared it.

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

Post your comment

Please log in or register to post a comment.