How To Guides

What is Function in C Language

A function is a self contained block of statements that perform logical task. C program is actually a collection of these functions. Using a function means hiring a perosn for a specific task.

  • A C program must have at least one function.
  • If a C prgram has more than one function then one of these functions has to be main() because execution of program begins with main().
  • There is no limit on the number of functions that might be present ina C program.
  • Each of the function is a program is called in sequence specified by the function calls in main().
  • After every function has performed it’s duty, control returns to main(). When main() runs out of the function calls the program ends. The main() function calls othe functions which will in return call other functions. You need to trace carefully the way control passes from one function to another.
  • A function gets called when the function name is followed by semicolon. For example





  • A function will be defined when the function name is followed by a pair of braces in one or more statements may be present.

argentina( )


statement 1 ;

statement 2 ;

statement 3 ;


  • Any function can be called from any other function. Even main() can be called from any other function. Even the main() can be called from any other function.
  • You can call any function for any number of times.
  • The order of the functions defined in a prgram and the order in which they get caleed necessarily be same.
  • A function can call itself like a procsss is called ‘recursion’.
  • A function can be called from other function but you can not define a function in another function.
  • A function has two types (i) Library functions (ii) User-defined functions