A multi fuction program
A function is a self contained block of code that perform a particular task.once a function has been designed
and packed .it can treated as a black box that takes some data from main program and return the values
Program:>b
#include
Void printline();
Main()
{
printline();
printf(“this world”);
printline();
{
Void printline()
{
int i;
For(i=0;i<40;i++)
Printf(“-“);
}
Getch();
}
Output:
---------------------------------------------------------------------
This world
---------------------------------------------------------------------
Explanation:
The above pgm contains two user defined function
Main()function
Printline()function
As we know that the pgm execution can start with the main()during execution of main,the first statement can be encountered as
Printline()
Which indicates that it will be executed first and the main()returen function and again printline()
Can be executed .When this pgm main() can be call the user defined function prinline()
function two times and library function once
recursive function in c
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment