如何在C中显示字符串"%5d"?我尝试在百分比前加一个反斜杠,但它不会打印(并发出警告).我试过谷歌搜索但无济于事.我想这对我来说太宽了,找不到具体的答案.
#include <stdio.h>
int main(void)
{
int test = 40;
printf("\%5.1d %5.1d", test); //this is the one
printf("%5.1d", test);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
有帮助吗?
Pra*_*rav 10
打印%尝试printf("%%");
这有效
printf("%%5.1d %5.1d", test);
Run Code Online (Sandbox Code Playgroud)