Function
What is Function?
Ans: - Function is the block of a statement that
can call by another function is called function.
Or: - A function is a set of statement that
takes input, do some specific computation, and produce output.
Note: - Function run only when it is called.
In C program function is divided into two parts: -
1.
Library Function or Pre
defined function
1.
Printf();
2.
Scanf();
3.
Strcpy();
4.
Puts();
5.
Etc.
2.
User defined Function.(created
by user )
1.
Void add();
2.
Int sum();
3.
Void m1();
4.
Void main();
User-defined function syntax: -
Return-type function-name( )
{
|| Statement;
}
Category of user-defined function: -
A function, depending on whether
arguments are present or not and whether a value is returned or not, may belong
to one of the following categories.
1.
Function with no
argument and no return values.
2.
Function with argument
and no return value.
3.
Function With argument
and return value.
4.
Function with no
argument but return value.
0 Comments