Prototype-Definition-Call of Function

This “Prototype-Definition-Call of Function in C” page providing clearly what are the 3 things required in the definition of function.


Function has…..

  • Prototype
  • Definition
  • Function call


Prototype :

  •  It is a statement.
  • It provides the information to the compiler and executor about user-defined functions.
  • It is equals to declaration of variable.
  • It is used to decide how much memory is required to execute function.


Definition :

  • Block of statements.
  • Contains function logic.
  • Must be called explicitly
  • It is also called module of a program.


Function call : 

  • It is a statement.
  • Used to access function logic.


The following diagram describes Prototype, Definition and Call by comparing with Variable:


Note the followings :

  • Every function gets executed inside the stack area.
  • When function execution starts, amount of space will be allocated inside the stack area to execute function logic is called FRAME.
  • FRAME gets destroyed once function execution has been completed.
  • “STACK memory full” error causes abnormal termination of program.


void display(void); –>prototype
void main()
printf(“ctrl in main \n”);
display(); –>function call
printf(“ctrl back to main \n”);
void display() –>function definition
printf(“ctrl in display”);


Share this