这些格式说明符的含义是什么?
%hd %hhd %ld %lld
%hd 用于short integer
或unsigned short integer
%hhd 用于short short integer
或unsigned short short integer
%ld 用于long integer
或unsigned long integer
%lld 用于long long integer
或unsigned long long integer
就那么简单。
这里h
, hh
, l
,ll
只是 %d 中的长度修饰符
Just look into the Documentation from Apple provided here: http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/Strings/Articles/formatSpecifiers.html
我认为IBM 的这份文档要好一些。所以:
%hd int x (short)x 10 1
%ld long x (long)x 10 1