我在看下面的代碼:C中的printf中沒有引號`PRIu32`?
#include <stdio.h>
#include <inttypes.h>
int main()
{
uint32_t total = 0;
printf("\tTotal: %"PRIu32"\n\n", total);
return total;
}
如何PRIu32
配合入printf
語法?我的意思是,我可以猜到,Iu32
可能意味着「整數無符號32位」。但是,我不確定在man 3 printf
中找到哪個表單可以容納引號外的變量 - 以及這可以如何推廣到引號外的其他語句。
如果您使用'gcc',請嘗試'gcc prog.c -E -P'。此外,在預編譯預處理中還會合並字符串文字序列,如「\ tTotal:%」「u」「\ n \ n」'。 – BLUEPIXY
@BLUEPIXY運行'$ gcc progc -E -P test.c'會給我'clang:error:no such file or directory:'progc''。那個命令應該做什麼? – Alex
將'prog.c'替換爲您嘗試編譯的C源文件。 – BLUEPIXY