随笔分类 -  C语言

C语言学习笔记
摘要:#1. 示例代码 ```c #include int main(int argc, char** argv){ char str[3][20]; puts("input a string seprator with \",\"\r\n"); scanf("%[^,],%[^,],%s",str[0] 阅读全文
posted @ 2023-07-20 11:39 tomhex
摘要:要在 GCC 中传递宏定义,可以使用 `-D `选项来定义宏并传递给编译器。 下面是在编译时传递宏定义的示例: `gcc -DDEBUG source.c -o program` 在上述示例中,`-DDEBUG` 定义了一个名为 `DEBUG` 的宏,并将其传递给编译器。在源代码中可以使用 `#if 阅读全文
posted @ 2023-07-15 09:59 tomhex
摘要:- 注意两者都有个define的作用,区别在于使用方式上。前者的通常用法是: ``` c \#ifdef XXX .... \#else .... \#endif ``` - 只能在两者中选择是否有定义。对于后者,常用法是: ``` c \#if defined xxx1 .... \#elif d 阅读全文
posted @ 2023-07-15 09:37 tomhex