Tuesday, 9 June 2015

Program to illustrate the functions returning pointers


Code for Program to illustrate the functions returning pointers in C++ Programming



 



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

 int *function();

 main()
    {
       clrscr();

       int *p;

       p=function();

       cout<<"\n Value return by the function returning pointer :"<<endl;
       cout<<"\t value of *p = "<<*p<<endl;

       getch();
       return 0;
    }


 /*************************************************************************///---------------------------  function( )  -----------------------------///*************************************************************************/int *function()
    {
       int i=10;
       int *j;

       j=&i;

       return j;
    }



 

No comments:

Post a Comment