C中的一些格式说明符
Some format specifier in C
请给我以下 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
以下是我确定知道的:
unsigned char:%u
(确保您的输出声明为 unsigned char)
例如:
unsigned char test = 500;
printf("%u", test);
无符号整数:%u
signed int: %i
或 %d
unsigned short int: %hu
可能有效。如果不是:%d
或 %u
也应该没问题。
signed int: %d
或 %i
短整数:%d
长整数:%ld
无符号长整数:%lu
signed long int:%ld
(不确定这个)。
long long:%lld
或 %llu
如果无符号
长双:%Lf
RTFM
这就是您要的:
https://msdn.microsoft.com/en-us/library/hf4y5e3w.aspx
这个用处比较大:
https://msdn.microsoft.com/en-us/library/56e442dc.aspx
请给我以下 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
以下是我确定知道的:
unsigned char:%u
(确保您的输出声明为 unsigned char)
例如:
unsigned char test = 500;
printf("%u", test);
无符号整数:%u
signed int: %i
或 %d
unsigned short int: %hu
可能有效。如果不是:%d
或 %u
也应该没问题。
signed int: %d
或 %i
短整数:%d
长整数:%ld
无符号长整数:%lu
signed long int:%ld
(不确定这个)。
long long:%lld
或 %llu
如果无符号
长双:%Lf
RTFM
这就是您要的: https://msdn.microsoft.com/en-us/library/hf4y5e3w.aspx
这个用处比较大: https://msdn.microsoft.com/en-us/library/56e442dc.aspx