Science, Tech, Math › Computer Science Definition of Function Prototypes in C and C++ Share Flipboard Email Print Hero Images/Getty Images Computer Science C & C++ Programming PHP Programming Perl Python Java Programming Javascript Programming Delphi Programming Ruby Programming Visual Basic View More By David Bolton David Bolton Computer Science Expert B.A., Computer Science, Queen's University Belfast David Bolton is a software developer who has worked for several major firms, including Morgan Stanley, PwC, BAE Systems, and LCH. Learn about our Editorial Process Updated on January 31, 2019 A function prototype is a declaration in C and C++ of a function, its name, parameters and return type before its actual declaration. This enables the compiler to perform more robust type checking. Because the function prototype tells the compiler what to expect, the compiler is better able to flag any functions that don't contain the expected information. A function prototype omits the function body. Unlike a full function definition, the prototype terminates in a semi-colon. For example: intgetsum(float * value) ; Prototypes are most often used in header files—although they could appear anywhere in a program. This allows external functions in other files to be called and the compiler to check the parameters during compilation. Purposes A function prototype ensures that calls to a function are made with the correct number and types of arguments.A function prototype specifies the number of arguments.It states the data type of each of the passed arguments.It gives the order in which the arguments are passed to the function. The function prototype tells the compiler what to expect, what to give to the function and what to expect from the function. Benefits Prototypes save debugging time.Prototypes prevent problems that occur when you compile using functions that were not declared.When function overloading occurs, the prototypes distinguish which function version to call. Cite this Article Format mla apa chicago Your Citation Bolton, David. "Definition of Function Prototypes in C and C++." ThoughtCo, Aug. 27, 2020, thoughtco.com/definition-of-function-prototypes-958077. Bolton, David. (2020, August 27). Definition of Function Prototypes in C and C++. Retrieved from https://www.thoughtco.com/definition-of-function-prototypes-958077 Bolton, David. "Definition of Function Prototypes in C and C++." ThoughtCo. https://www.thoughtco.com/definition-of-function-prototypes-958077 (accessed June 4, 2023). copy citation Featured Video