bac*_*113 4 c printf format-specifiers conversion-specifier length-modifiers
表达这个问题的另一种方式可能是“如何在 printf 中结束格式说明符”
如果我想100us使用以下代码以这种格式打印微秒......
long microseconds = 100L;
printf("%lus", microseconds);
Run Code Online (Sandbox Code Playgroud)
只打印,100s因为 theu与 the 组合%l,并且它将格式说明符解释为 anunsigned long而不是 along
写吧
long microseconds = 100L;
printf("%ldus", microseconds);
Run Code Online (Sandbox Code Playgroud)
请注意,如果没有转换说明符,则不能使用长度修饰符。