iOS NSLog %hd %hhd %ld and %lld format specifiers [closed]

六月ゝ 毕业季﹏ 提交于 2019-12-11 12:15:13

问题


What would be the meaning of these format specifiers?

%hd %hhd %ld %lld

回答1:


%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




回答2:


Just look into the Documentation from Apple provided here: http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/Strings/Articles/formatSpecifiers.html




回答3:


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


来源:https://stackoverflow.com/questions/17854628/ios-nslog-hd-hhd-ld-and-lld-format-specifiers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!