在嵌入式c中,往往采用串口打印函数来实现程序的调试,而在正式程序中一般是不需要这些打印代码的,通常做法是在这些调试用打印代码的前后设置一个宏定义块来实现是否启用这段代码,比如: // other user code ... #ifdef USE_DEBUG printf("the monitor count is %d", count); #endif // other user code ... 如果定义了USE_DEBUG,则打印起作用:否则上述代码块不会被编译. 但上述代码块存在
#include <stdio.h> //int gys(int a,int b);//函数声明 int main() { int a = 520; int c1=98; int c2=56; char b = 'F'; float c = 3.14; double d = 3.141592653; printf("%d,%d\n",a,b); printf("%10d,%d\n",a,b); printf("%10d,%5d\n",