COMPONENTS OF
FUNCTIONS :
1. Proto type declaration
2.Function
definition
3.Function call
Prototype declaration
Before the function is defined in the program , the
function name and its details should be provided to the compiler and it can be done by declaring the function above the main
function and such statement is known as Prototype of function or forward
declaration of function.
Syntax
<return_type> Function_name(Argument list);
Example:
Void message();
Int sum(int,int);
Function defination
It is the main part of the function that contains
actual logic which perform specific operations of function.the programming
statements should be written between flower braces { }.
Syntax
<return_type>Function_name(Argument list)
{
Function Body
}
Example:
Void message()
{
Statements…………….
}
Int sum(int x, int y)
{
Int z;
Z=x+y;
return (z);
}
}
Function call
Defining the function does not do anything it should
executed .and it can be done by function call .
And a
function can be called simply by
its name. A function call is specified
by the function name enclosed arguments with in parenthesis, terminated by
semicolon(;).
Syntax:
Function_name(arguments_list);
Example:
Message();
Sum(int,int);
Note: A function call should
not have any return type


08:46
Unknown
0 comments:
Post a Comment