[leechul@~/C_Study]leechul cat 011-function-pointer.c
#include <stdio.h>
int add_numbers(int a, int b)
{
int sum;
sum = a + b;
return sum;
}
int main(int argc, char argv[])
{
int result;
//function pointer
int (*myfunc_ptr)(int, int);
myfunc_ptr = &add_numbers;
result = myfunc_ptr(3,5);
printf("result = %d\n", result);
return 0;
}
[leechul@~/C_Study]leechul gcc 011-function-pointer.c -o 011-function-pointer.o
[leechul@~/C_Study]leechul ./011-function-pointer.o
result = 8
'C Programing' 카테고리의 다른 글
main function arguments (0) | 2013.12.08 |
---|---|
structure (0) | 2013.12.08 |
array (0) | 2013.12.08 |
for-loop (0) | 2013.12.08 |
pointer (0) | 2013.12.08 |