Ask Question

Why do you need to include function prototypes in a program that contains user-defined functions?

+4
Answers (1)
  1. 15 May, 00:37
    0
    One file becomes one object module and become part of the program or library. In case I had a function definition in another. cpp file and the function call in another. cpp file, how would the function be made known? Function Prototypes.

    Either the file calling the function from a different file implements a function prototype or it will include the prototypes via header file. What you know now is that the prototype propagates that a function definition is present though the compiler does not "see" the definition, when compiling the current module.

    If the function definition is not there at link time then you would face a linker error.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Why do you need to include function prototypes in a program that contains user-defined functions? ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers