Function returning a Pointer


    #include <iostream.h>
    #include <conio.h>
    void main ()
    {
        int *square ( int *a ) ;
        int i, *result ;
        clrscr () ;

        cout<<"i = " ;
        cin>>i;
        result = square ( &i ) ;
        cout<<"square ( i ) : "<<*result ;
    }
    int *square ( int *a )
    {
        *a = *a  *  *a ;
        return ( a );
    }

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|