FUNCTION
C programming is a collection of function .Function is block of code or statement to perform a particular task . In every program, there exists at least a single function called as main function i.e main( ) . Main( ) function executes the program automatically.
TYPE OF FUNCTION :
1) library function : printf ( );
scanf( );
pow( );
sqrt ( );
2)User defined function : add (a,b);
factorial (n);
fibonacci (n);
COMPONENT OF FUNCTION :
- Function prototype / function declaration
- Function call
- Function definition
CATEGORY OF FUNCTION :
- No return type with argumnets
- No return type with no arguments
- Return type with no arguments
- Return type with arguments
Recursive function :
The function calling itself is called recursive function. Recursion is the process through which a function calls itself repeatedly until some specified condition is satisfied .
For recursive function, following two condition must be satisfied .
- The problem must be defined or written in terms of previous result .
- There must be stopping condition.
No comments:
Post a Comment