Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int sum(int a, int b) {
- return a + b;
- }
- int dif(int a, int b) {
- return a - b;
- }
- int mul(int a, int b) {
- return a * b;
- }
- int div(int a, int b) {
- return a / b;
- }
- int main() {
- int (*p[4])(int, int) = {sum, dif, mul, div};
- for (int i = 0; i < 4; i++) {
- printf("%d\n", (*p[i])(1, 2));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement