Beruflich Dokumente
Kultur Dokumente
Library Function
or
Standard-in-built Function
or
Compiler Function
(like sqrt(),pow(),tan(),etc.)
User-Defined Function
or
Self-contained Program
or
Call-by-value & Call-by-reference Function
(like addition(),rajan(),factorial() etc.
ADVANTAGES OF FUNCTION
SUB-PROGRAM
return();
}
Returning statement
Returning
control
If nothing returned
return;
or, until reaches right brace
If something returned
return(expression);
Function prototype
Function name
Parameters what the function takes in
Return type data type function returns (default
int)
Used to validate functions
Prototype only needed if function definition comes
after use in program
The function with the prototype
CATEGORIES OF FUNCTIONS
int p,r,t,s;
print(Enter the value for p,r,t,s:\n);
scanf(%d %d %d,&p,&r,&t);
si(p,r,t,s); /*formal parameters*/
getch();
}
si(int x,int y,int z)
{
int m;
m=(x*y*z)/100;
printf(\nSimple Interest is:%d,m);
return;
}
void main()
{
int p,r,t,si;