编程常见的数据类型和占位符的对应关系:
数据类型 占位符 所占空间大小
char / unsigned char %c 1 Byte(字节)
short %hd 2 Byte
unsigned short %hu 2 Byte
int %d 4 Byte
unsigned int %u 4 Byte
long %ld 4 Byte
unsigned long %lu 4 Byte
float %f / %g 4 Byte
double %lf / %lg 8 Byte
char / unsigned char %c 1 Byte(字节)
short %hd 2 Byte
unsigned short %hu 2 Byte
int %d 4 Byte
unsigned int %u 4 Byte
long %ld 4 Byte
unsigned long %lu 4 Byte
float %f / %g 4 Byte
double %lf / %lg 8 Byte