Elements of user-defined functions


We have discussed and used different types of data types and variables in our programs so far. However, these variables were declared and used inside the main () function. As we mentioned in the previous tutorial, functions are classified as one of the source data types of C so we can define functions and use them like other variables in C programs. So it is not surprising to notice that C has some similarities between functions and variables

To use user-defined functions, we need to set up three elements related to the function.

  1. Function definition.
  2. Function call.
  3. Function declaration.

Function Definition is a unique program module that is specifically written to implement functional requirements. To use this function, we need to pray it is a necessary place in the program. This is known as a function call. The program that calls the function is referred to as the calling program or calling function. Any function used later in the calling program tutorial should be declared. This is known as function declaration or function prototype.