Function Prototype in C++

A function prototype tells the compiler the name of the function, the types  of data returned by the function, the number of parameters(void odd(int Aa)) the function expects to receive, the types(int,float) of the parameters and the order in which these parameters are expected. The compiler uses function prototypes of validate function calls.

 

 

//Program declaring function prototype

#include<iostream.h>

#include<conio.h>

void odd(int Aa);

void even(int Aa);

void main()

 {

     int Ii;

     clrscr();

     do

       {

         cout<<"Type a number(0 to exit)";

         cin>>Ii;

         odd(Ii);

       }

    while(Ii!=0);

}

void odd(int Aa)

  {

      if((Aa%2)!=0)

              cout<<"Aa No. is odd"<<endl;

      else

              even(Aa);

    }

void even(int Aa)

  {

     if((Aa%2)==0)

           cout<<"Aa No. is even"<<endl;

     else

           odd(Aa);

    }

Output....

Function Prototype in C++

About Us

Rekha SetiaRekha Setia is a passionate blogger of Extra Computer Notes. if you have any ideas or any request me @