#include <stdio.h>
#define stringify(s) tostring(s)
#define tostring(s) #s
#define MAX_VALUE 65536
#define NUM 64 * 1024
enum {
MIN_VALUE = 1024,
};
int main(int argc, char *argv[])
{
const char *max_str = stringify(MAX_VALUE);
const char *min_str = stringify(MIN_VALUE);
printf("max = %s, min = %s\n", max_str, min_str);
return 0;
}
输出为“max = 65536, min = MIN_VALUE num = 1024 * 64” 专家,我怎样才能修改我的代码输出这样的: 最大 = 65536,最小 = 1024 num = 65536
谢谢。
最佳答案
MIN_VALUE 是一个数字。为什么需要对其进行字符串化?
只需使用:
printf("%d\n", MIN_VALUE);
关于c - C语言将数字打印成字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14494863/