From d58ce75182396924a968ac4db28fc409a5457c44 Mon Sep 17 00:00:00 2001 From: zhangyongpan Date: Tue, 15 Jul 2025 14:03:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0c=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hello.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 hello.c diff --git a/hello.c b/hello.c new file mode 100644 index 0000000..fce69a1 --- /dev/null +++ b/hello.c @@ -0,0 +1,13 @@ +int add(int a, int b) { + return a + b; +} + + + + +int main() { + MathFunc f = add; // 将加法函数赋值给函数指针 + int result = f(3, 5); // 通过函数指针调用加法函数 + printf("3 + 5 = %d\n", result); // 输出:3 + 5 = 8 + return 0; +} \ No newline at end of file