//========================
//Program in C to display "function pointer", funcptr.cpp
//========================
#include<iostream>
using namespace std;
typedef void (* FunctionPointer)(int x, int y);
void sumFunction(int i, int j)
{
cout<<i+j<<"\n";
}
void subtractionFun(int m, int n)
{
cout<<m-n<<"\n";
}
int main()
{
FunctionPointer ptr;
ptr=&sumFunction;
ptr(1,2);
ptr=&subtractionFun;
ptr(2,1);
return 0;
}
How to use function pointer in CPP/CPP
How to use function pointer in CPP/CPP
How to use function pointer in CPP/CPP
How to use function pointer in CPP/CPP
//Program in C to display "function pointer", funcptr.cpp
//========================
#include<iostream>
using namespace std;
typedef void (* FunctionPointer)(int x, int y);
void sumFunction(int i, int j)
{
cout<<i+j<<"\n";
}
void subtractionFun(int m, int n)
{
cout<<m-n<<"\n";
}
int main()
{
FunctionPointer ptr;
ptr=&sumFunction;
ptr(1,2);
ptr=&subtractionFun;
ptr(2,1);
return 0;
}
How to use function pointer in CPP/CPP
How to use function pointer in CPP/CPP
How to use function pointer in CPP/CPP
How to use function pointer in CPP/CPP
Program in C++ to display "function pointer", funcptr.cpp
ReplyDeleteProgram in C++ to display "function pointer", funcptr.cpp
How to use function pointer in C++
How to use function pointer in C++Program in C++ to display "function pointer", funcptr.cpp
Program in C++ to display "function pointer", funcptr.cpp
How to use function pointer in C++
How to use function pointer in C++Program in C++ to display "function pointer", funcptr.cpp
Program in C++ to display "function pointer", funcptr.cpp
How to use function pointer in C++
How to use function pointer in C++