manishnips.blogspost.com

Function


                                                                FUNTION
    *            The number of statements grouped in a logical unit to perform to some specifics task.
    *             Function makes program easier to understand and maintain.
    *             There are two types of function.
1. Library function
2. User defined function
1. Library (Built in function)
    *            The predefine function, is called library function.
    *            When we use any library function then respective header file must be included. Otherwise we get prototype Error.
    *            We can’t understand internal working of library function.
    *            We are not able to modified them.
    *            Examlpe : sqrt(),pow(),clrscr() …. etc .
2. User defined function
      *            The function defined by the user , is known as user defined data type.
      *            No need of any specific task.
      *            We can understand internal working of user define data type.
      *            We can modify user defined function when ever essential.
      *            We can create own header files. By the using user defined function.
      *            Example: square IE. Square(81)=6561
Parts of Function
1)    Function prototyping
    *            It determines function name,number of argument and their type and return types also.
    *            It is generally located as the top of the program. (After header file).
    *            Example:    void sum(int,int);
                                                                      Data type(no. of arguments)
                                        Function name
                             Return type
2)    Function calling
    *            It needs when we want to execute the statement of function body.
    *            When we call(invoke) function any number of times.
    *            Example: sum(a,b);
3)    Function definition
    *            It contains the statement which can be execute after calling.


Previous
Next Post »