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 ";
}
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