C Functions

Functions

A function is a complete and independent program which is used (or invoked) by the main program or other subprograms.
A subprogram receives values called arguments from a calling program, performs calculations and returns the results to the calling program.
The basic philosophy of function is divide and conquer by which a complicated tasks are successively divided into simpler and more manageable tasks which can be easily handled.

Function definition:

[data type] function name (argument list) 
  argument declaration; 
 { 
      local variable declarations; 
      statements; 
      [return expression] 
} 
Example :
       mul(a,b) 
       int a,b; 
       { 
		int y; 
		y=a+b; 
		return y; 
	   } 
When the value of y which is the addition of the values of a and b. the last two statements ie,
y=a+b;
can be combined as
return(y)
return(a+b);


Make Comments..!!


Oops!! No posts from user.