2009-10-26
const int LIM = 50;
const int LIM2 = 2 * LIM;/*error*/
const int LIM2 = 2 * LIMIT;
0 不是字符'0',而是ascii码表中的'/0',也就是字符串结束符。
/*#x字符串化*/
#ifdef MAVIS
#include "horse.h"
#define STABLES 5
#else
#include "cow.h"
#define STABLES 15
#endif
ifndef SIZE//如果没定义SIZE
#define SIZE 100
#endif
#if SYS == 1
#include "ipmpc.h"
#elif SYS == 2
#include "vax.h"
#elif SYS == 3
#include "mac.h"
#else
#include "general.h"
#endif
本文通过几个具体的C语言示例介绍了宏定义及其字符串化操作的应用。展示了如何使用宏定义来实现灵活的代码生成和调试信息输出,以及如何利用字符串化进行特定的字符串输出。
6万+

被折叠的 条评论
为什么被折叠?



