Example : Using function

#include <iostream.h>
#include <conio.h>
void fun( ); // prototype declaration
void main( )
{
clrscr( );
cout<<”We are in main\n”;
fun( ); // function call
cout<<”Back in main\n”;
getch();
}
void fun( ) // function definition
{
cout<<”We are in function\n”;
}
Output :
We are in main
We are in function
Back in main

0 comments: