Wednesday, 2 July 2014

C++ program to invoke a function using pointer


Here is a C++ program to invoke a function using pointer


 SOURCE CODE OUTPUT
#include<iostream>
using namespace std;
int main()
{
    void fact();
    void (*ptr)();
    ptr=fact;
    ptr();/*calling function using pointer*/
    return 0;
}
void fact()
{
    cout<<"Function is invoked ";
}

Any questions regarding to program please write in comments.

No comments:

Post a Comment