摘要: #if #if condition 根据condition的值决定是否编译代码 condition中只能有宏和常量 #ifdef 判断宏是否定义,不推荐使用,这是为了兼容以前的写法 #if defined 判断宏是否定义,推荐使用 阅读全文
posted @ 2024-05-26 21:55 NotReferenced 阅读(10) 评论(0) 推荐(0) 编辑
摘要: extern关键字的作用就是告诉编译器,去别的地方找这个函数或者变量的定义。 1、引用另一个文件中的变量 main.c #include<stdio.h> int main() { extern int num; printf("%d",num); return 0; } b.c #include< 阅读全文
posted @ 2024-05-26 21:06 NotReferenced 阅读(22) 评论(0) 推荐(0) 编辑