C中的一些格式说明符

时间:2015-03-29 21:49:31

标签: types primitive-types

请告诉我C中以下数据类型的格式说明符。

unsigned char,signed char,unsigned int,signed int,unsigned short int,signed int,short int,long int,unsigned long int,signed long int,long long,long double

2 个答案:

答案 0 :(得分:0)

以下是我肯定知道的:

unsigned char:%u(确保输出声明为unsigned char)

前:

unsigned char test = 500;
printf("%u", test);

unsigned int:%u

signed int:%i%d

unsigned short int:%hu可能有用。如果不是:%d%u也应该没问题。

signed int:%d%i

short int:%d

long int:%ld

unsigned long int:%lu

签名long int:%ld(不确定这个)。

多长:%lld%llu如果未签名

long double:%Lf

答案 1 :(得分:0)