To define user defined function in our program file at the top of the main() function or below of the main function.It can't be defined in the body of main function.
user defined function can be written in to a saperate file also.
syntax:-
datatype function name (argument with data type)
{
statement;
...................
.................
.................
return(exp);
}
:- Were datatype of a function depends up on the datatype of return value by the function.
:-The rule of function name is same as the rule of variable name.
:-Argument is also called parameter.The variable name or name are declared with in the paranthesis() of a function is called arguments.
Note :- If a function doesn't return any function the data type of function is void(null datatype).
In c language it is optimal.
Thanks for giving me this knowledge
ReplyDelete