Program to illustrate Pointer Function

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

        result = (*a)() ;    /* Function call using pointer 'a' */

        cout<<"Result = "<<result ;

        getch () ;
    }
    double function ()
    {
        double a, b ;

        a = 10.5 ;
        b = 20.3 ;
        a = a + b ;

        return ( a ) ;
    }

0 comments:

Post a Comment

 
 
 
 


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