cst181-1 Lecture8
cst181-1 Lecture8
cst181-1 Lecture8
structured Programming
Laboratory Session 08
Home work Assignment
Reasons to Use Functions
Two types:
Standard library functions(builtin)
User defined functions
Two varieties:
Those with return values
(Produces a value that can be assigned to a
variable.)
Those with none.
Functions
Prototypes of functions
int main( )
{
..........
}
function_1( )
{
...........
}
function_2( )
{ .........}
Functions
int main()
{
int p;
printf("Enter the number:\n");
scanf("%d",&p);
printf("square is %d\n",square(p));
}
Example02