Program for Pointer to Function ( with arguments )


    #include <iostream.h>
    #include <conio.h>
    void main ()
    {
        double (*a)( double, int ); /* Pointer to Function declaration */
        double function ( double a, int b ) ;
        double result ;

        clrscr () ;
           a = function ;                    /* Pointer to Function assignment */

        result = (*a)( 12.7, 23 ) ; /* Function call using pointer 'a' */
       
        cout<<"Result = "<<result ;

        getch () ;
    }

    double function ( double a, int b )
    {
        a = a + b ;
        return ( a ) ;
    }

0 comments:

Post a Comment

 
 
 
 


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