M
Michael
Hi,
My understanding of
int op(int x, int y, int (*func)(int,int)).
when n = op (20, m, minus); minus is a function pointer, which
matches parameter.
when m = op (7, 5, addition);there is a sort of conversion, is that?
addition is function not a point function. How to undestand here.
Thanks in advance,
Michael
#include <iostream>
using namespace std;
int add(int a, int b)
{ return (a+b); }
int sub(int a, int b)
{ return (a-b); }
int (*minus)(int,int) = subtraction;
int op(int x, int y, int (*func)(int,int))
{
int g;
g = (*func)(x,y);
return (g);
}
int main ()
{
int m,n;
m = op (77, 15, addition);
n = op (20, m, minus);
cout <<n;
return 0;
}
My understanding of
int op(int x, int y, int (*func)(int,int)).
when n = op (20, m, minus); minus is a function pointer, which
matches parameter.
when m = op (7, 5, addition);there is a sort of conversion, is that?
addition is function not a point function. How to undestand here.
Thanks in advance,
Michael
#include <iostream>
using namespace std;
int add(int a, int b)
{ return (a+b); }
int sub(int a, int b)
{ return (a-b); }
int (*minus)(int,int) = subtraction;
int op(int x, int y, int (*func)(int,int))
{
int g;
g = (*func)(x,y);
return (g);
}
int main ()
{
int m,n;
m = op (77, 15, addition);
n = op (20, m, minus);
cout <<n;
return 0;
}