user-defined function in C ?


The functions written by the programmer or user to do the specific tasks are called user defined function or programmer defined function.

Elements of user-defined function:-

  1. function definition
  2. function call
  3. function declaration

function definition

The program module that is written to achieve a specific task is called function definition.

Each function definition consists of two parts:
  • Function header:- consisting of data types of the value returned by the function the name of the function and parameters.
  • Function body:- consisting of set of instruction to do the specific activity.
function call

Once the function is defined, it has to be called so as to achieve the task this method of calling a function to achieve a specified task is called function call.