iOS NSLog %hd %hhd %ld and %lld format specifiers

2019-08-07 08:07发布

What would be the meaning of these format specifiers?

%hd %hhd %ld %lld

3条回答
可以哭但决不认输i
2楼-- · 2019-08-07 08:55

I think this document from IBM is a bit better.So:

  %hd       int x          (short)x           10     1
  %ld       long x         (long)x            10     1
查看更多
Anthone
4楼-- · 2019-08-07 09:00

%hd is used for short integer or unsigned short integer

%hhd is for short short integer or unsigned short short integer

%ld is for long integer or unsigned long integer

%lld is for long long integer or unsigned long long integer

Simple as that.

Here h , hh , l , ll are just length modifiers in %d

Source: http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/Strings/Articles/formatSpecifiers.html

查看更多
登录 后发表回答