Abstract


Function Prototype

  • In C, a function prototype consists of the return type, name of the function, and the list of parameter datatypes (names of parameters are optional)

Placement of function prototype

It’s good practice to put function prototypes at the top of the program, before the main() function. This informs the compiler of the functions your program may use, along with their return types and parameter types.

Without function prototypes , you’ll receive error or warning messages from the compiler like implicit declaration of function.

Function definition

Function definitions should follow after the main() function. So main() stays at the top of the program which makes it easier to analyse.

Important

Without function prototype, C assumes the default(implicit) return type of the custom functions is int.

Important

Always end the function prototype with ;!

Function Definition