3 回答
TA贡献1793条经验 获得超6个赞
#include <stdio.h>volatile unsigned int stop_now = 0;extern void bar_function(void);int main(void){
while (1) {
bar_function();
stop_now = 1;
}
return 0;}#include <stdio.h>extern volatile unsigned int stop_now;void bar_function(void){
while (! stop_now) {
printf("Hello, world!\n");
sleep(30);
}}通过使用“extern”,您是在告诉编译器,在链接时将找到任何跟随它的东西(非静态的);不要在当前传递中为它保留任何东西,因为以后会遇到它。在这方面,函数和变量受到平等对待。
TA贡献2019条经验 获得超9个赞
- 3 回答
- 0 关注
- 724 浏览
添加回答
举报
