Skip to main content

Posts

Showing posts with the label Returning a pointer

Returning a pointer

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); }