unsigned long printId = 0; char str[100] = {0}; #define MYPRINTF(fmt, ...) do{sprintf(str,"%ld:%s",++printId,fmt);printf(str, __VA_ARGS__);memset(str,0,strlen(str));}while(0)
调用方式:
MYPRINTF("父亲: 放苹果之后, 剩余空间=%u, 苹果数=%u ", vremain, vapple);
结果:
unsigned long printId = 0; char str[100] = {0}; #define MYPRINTF(fmt, ...) do{sprintf(str,"%ld:%s",++printId,fmt);printf(str, __VA_ARGS__);memset(str,0,strlen(str));}while(0)
调用方式:
MYPRINTF("父亲: 放苹果之后, 剩余空间=%u, 苹果数=%u ", vremain, vapple);
结果: