Code Competitions

Coding competition

Wednesday, 29 May 2013

program to pass address of function to another function

#include<iostream.h>
#include<conio.h>
inline add(int a,int b)
{
    return(a+b);
}
void main()
{
    int (*ptr)(int,int),a;
    clrscr();
    ptr=&add;
    cout<<"\nthe result 1 "<<ptr(6,33);
    cout<<"\nthe result 2 "<<(*ptr)(5,8);
    cout<<a;
    getch();
}

OUTPUT:


No comments:

Post a Comment