Function Prototype Declaration

Function Prototype Declaration is a statement in which programmer describes three information about a function:

  1. Symbol name of the function
  2. Return type of the function
  3. Arguments that will be taken as input
<return type> <function name>()<arguments>;

int add( int a, int b);

Function Definition

Definition is the actual body/source code of the function. It may contain one or more statements inside it.

<return type> <function name>()<arguments>
  return ;

int add( int a, int b)
  return (a + b);
By default, any C function returns an int value.
add(int a, int b) is same as int add(int a, int b);

If we want the function to return a variable type other than integer, we have to explicitly mention the return type (float or char) before the name of the function during definition and declaration.

A good programming practice is that declaration should be in a header file and definition should be in a source file.

About our authors: Team EQA

You have viewed 1 page out of 252. Your C learning is 0.00% complete. Login to check your learning progress.