Thursday, July 11, 2019

Function

Function:



we can divide a large program into the basic building blocks known as function.
By using function we can avoid rewrition of same code multiple times.


Function will creates once and used multiple times in a program.A function is a block of statements that performs a specific task.function makes the program more readebale and understandeble.

Syntax of Function:

   return-type function-name(parameters list)
   {
    //operation;
   }


   Their are mainly two types of function:-

    1.Predefined function
    2. Userdefined function


1.Predifined Function:
   

C having a some of their own functions like main(),getch(),puts(),printf(),etc. To use this function user will include header files.

 2. Userdefined Function: 
   
This function is created by the users accordinig to their needs.
 
Their are certain forms of function calling which are as follows:

        1.Function without arguments and without return value.
2.Function without arguments and with return value.
3.Function with arguments and without return value.
4.Function with arguments and with return value.


1].Function without arguments and without return value:

In this form function does not passes any arguments or parameter and doesnot return any kind of value.

2].Function without arguments and with return value:
   
In this form of function does not passes any arguments or parameter but it returns some value.

3].Function with arguments anf without return vlaue:
   
In this form of function passes argument or parameter but does not return any value.

4].Function with arguments and with return value:
   
In this form of function passes arguments or parameter also returns some values.


EmoticonEmoticon