+ 1

What is the purpose of function prototypes in C?

Are they required? What purpose do they serve?

19th Oct 2018, 6:41 PM
Drew Pesall
Drew Pesall - avatar
1 Answer
+ 3
Real program consists of multiple files. You need to write function prototype in one file to be able call function from another one. Usually all function prototypes are placed in header files which then included if required. There is other interesting case with recursion. If we have a first function that calls second one while the second function calls the first then we are unable to write such construction without function prototype.
19th Oct 2018, 7:00 PM
Sergey Ushakov
Sergey Ushakov - avatar