C基本类型有:
char:8位,可添加修改符signed或是unsigned
short:16位,同有singed和unsigned
int:32位,同有singed和unsigned
long:在32位系统为32位,64位系统为64位,分为signed和unsigned
long long:64位,分为signed和unsigned
float:32位,精确度为6
double:64位,精确度为15
long double:80位,精确度为19
C中没有bool类型,可以引入stdbool.h文件使用定义的bool,true, false宏
常用字面值使用:
int in = 1234;
long ln = 1234L;
unsigned int uin = 1234U;
unsigned long uln = 1234UL;
float f = -12.34e-1f;
double df = 123.45;
long double ldf = 123.45L;
时间: 2024-10-10 21:00:56