Saturday 5 May 2018

FUNCTION

                                    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 :

  1. Function prototype / function declaration
  2. Function call
  3. Function definition

     

CATEGORY OF FUNCTION :

  1. No return type with argumnets
  2. No return type with no arguments
  3. Return type with no arguments
  4. 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 .
  1.  The problem must be defined or written in terms of previous result .
  2. There must be stopping condition.
 

No comments:

Post a Comment

HTTP

Q 1) Why HTTP is called stateless protocol ? answer:           HTTP is stateless protocol which means that a different connection betwee...