如何使用printf打印unsigned long long类型整数

使用%ull 即可

以前在网上搜找到的是直接用%lld就行了,但实际上如果遇到要打印的unsigned long long大于 long long的上限的话,printf打印出来的结果将不是预期的

=。=今天打acm遇到一道题刚好就被这里卡了,用lld输出过不了,llu就行

specifiers
length d i u o x X f F e E g G a A c s p n
(none) int unsigned int double int char* void* int*
hh signed char unsigned char signed char*
h short int unsigned short int short int*
l long int unsigned long int wint_t wchar_t* long int*
ll long long int unsigned long long int long long int*
j intmax_t uintmax_t intmax_t*
z size_t size_t size_t*
t ptrdiff_t ptrdiff_t ptrdiff_t*
L long double

*上表来自cpp Reference

 

原创文章,转载请注明: 转载自YXZ’s Blog

本文链接地址: 如何使用printf打印unsigned long long类型整数

1 Response

  1. FirstFlorene 2017 年 10 月 3 日 / 上午 8:47

    I have noticed you don’t monetize your page, don’t waste your traffic,
    you can earn additional cash every month because you’ve got high quality content.
    If you want to know how to make extra bucks, search for: Mrdalekjd methods for $$$

发表评论

电子邮件地址不会被公开。 必填项已用*标注

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>