Program to illustrate a function returning a pointer

////////////////////////////////Tested By C++ and Created////////////////////////////////////////


#include<iostream.h>
#include<conio.h>

int *big(int &,int &);

void main()

{  int a,b,*c;

clrscr();

cout<<"\t\tPROGRAM TO ILLUSTRATE A FUNCTION RETURNING A POINTER\n\n";

cout<<"\tENTER TWO INTEGER\t";cin>>a>>b;

c=big(a,b);

cout<<"\n\tTHE BIGGER VALUE IS\t"<<*c<<"\n";

getch();

}

int*big(int & x, int & y)

{   if(x>y) return (&x);

    else    return (&y);

}

Designed By Blogger Templates | Templatelib & Distributed By Blogspot Templates