Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
257 views
in Technique[技术] by (71.8m points)

c - printf的格式很长的论点是什么?(What is the argument for printf that formats a long?)

The printf function takes an argument type, such as %d or %i for a signed int .

(printf函数采用参数类型,例如%d%i用于signed int 。)

However, I don't see anything for a long value.

(但是,我没有看到任何long价值的东西。)

  ask by Thomas Owens translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Put an l (lowercased letter L) directly before the specifier.

(在说明符之前直接放置l (小写字母L)。)

unsigned long n;
long m;

printf("%lu %ld", n, m);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...