Pointer to Function Question **

  • Thread starter Thread starter Khanh01
  • Start date Start date
K

Khanh01

Guest
Hi, I want to ask this problem: my code have a pointer scnf to function
<Do not edit the total sum function>

I want when the totalsum executes will call scnf with first parameter equal to pt1 (pt1 is entered by the user - it may change)
I tried to use

scnf = newSum;
scnf (pt1,5);

However this doesn't work? I think it is possible to use global variables, but is there a different solution?


int pt1=3

int (*scnf)(int pt, int mt);

scnf=newSum;
scnf(pt1,5);


rc = Totalsum( ssname,
L"Select number",
0,
scnf,
return_sum);

//---------------------------------------------

int newSum(int num1, int num2) {
custom(num2); //custom function
custom(num1)
return 1; //
}

Many thanks!

Continue reading...
 
Back
Top