Created
August 14, 2015 08:02
-
-
Save derofim/cd8e0ec7126d3e47df71 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| int add ( int a, int b ) { return ( a + b ); } | |
| int sub ( int a, int b ) { return ( a - b ); } | |
| int main() | |
| { | |
| using namespace std; | |
| int ( *pf ) ( int, int ) = add; | |
| cout << pf ( 3, 2 ) << endl; // Вывод: 5 | |
| cout << pf ( 4, 5 ) << endl; // Вывод: 9 | |
| pf = sub; | |
| cout << pf ( 3, 2 ) << endl; // Вывод: 1 | |
| cout << pf ( 4, 5 ) << endl; // Вывод: -1 | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment