` int executed = 0; void function_once() { if (executed == 0) { // 执行函数内容 executed = 1; } } 函数指针法 通过将函数指针赋值给一个静态函数指针变量,并在第一次调用函数后将其置为NULL,可以防止函数再次执行。代码示例如下: ` void function_once() { static void (*func_ptr)() = fu...