return function pointer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <stdio.h> int add (int , int); int (*getAdd(void)) (int, int); int main (void) { int (*functionPointer) (int, int); functionPointer = getAdd(); printf("%d\n", functionPointer(10, 20)); return 0; } int add (int number1, int number2) { return number1 + number2; } int (*getAdd(void)) (int number1, int number2) { return add; } | cs |
0 개의 댓글:
댓글 쓰기