25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
262 B

  1. int add(int a, int b) {
  2. return a + b;
  3. }
  4. int main() {
  5. MathFunc f = add; // 将加法函数赋值给函数指针
  6. int result = f(3, 5); // 通过函数指针调用加法函数
  7. printf("3 + 5 = %d\n", result); // 输出:3 + 5 = 8
  8. return 0;
  9. }