0
Scope Resolution Operator / Pointer Question
int f1(int x, int y) {return x+y;} int f2(int x, int y) {return x-y;} int main () { cout << f2(2, 2); // this would pass parameter values to int f2 and print 0 int(*f2)(int, int) = f1; // would this mean that the f2 pointer is pointing to f1's address? cout << f2(2, 2); // wouldn't this still be 0? Why pass parameter values to int f1? f2 = ::f2; // what does the ' :: ' do? cout << f2(2, 2); // totally lost at this point } // output is 040
1 Odpowiedź
0
How come the line
' cout << f2(2, 2); ' after line
' int(*f2)(int, int) = f1; ' did not include an asterisk before the f?