c语言中的变量及常量

变量
char 字符型变量,长度为一个字节
short 短整形,长度为两个字节
int 整形变量,长度为四个字节(定义整形变量时优先考虑使用int)
long 长整形变量,长度为四个字节
long long 更长的整形变量,长度为八个字节
float 单精度浮点数,长度为四个字节
double 双精度浮点数 ,长度为八个字节
定义浮点数时优先使用double,定义整形变量时优先考虑使用int。
常量
(1)字面常量
(2)修饰常量,const。
#include <stdio.h> const int a=100; int main(){ const int a=100; printf("%d/n",a)
}
(3)宏定义
(4)枚举,enum#include <stdio.h> enum SEX {MALE, FEMALE, };

猜你喜欢

转载自blog.csdn.net/huanglu12138/article/details/83317035