21天学通C语言第三天---存储类型

来源:互联网 发布:淘宝首页优惠券代码 编辑:程序博客网 时间:2024/05/22 22:11

几个概念:

1T=1024GB
1G=1024MB
1M=1024KB
1KB=1024B(bytes). bytes为字节的意思
1B=8b(bit) 位

变量所占大小:

char           1B
int               2B(pc)or4B(VAX)

long           4B

float           4B

double       8B

typedef用于给已有的数据类型一个新的名称.such as   :typedef int integer

常量:符号常量(#define and const)和字面常量

#define and const的区别

 1   define由预处理程序处理,const由编译程序处理,因此const可以用调试工具查看,const 也需要占用内存,并且需要占用文件空间,   
  2   作用域不一样,const分局部和全局,而define   为文件作用域。

链接:http://www.it130.cn/Article/bianchengwendang/C++/2007-2-4/2007020417375830.html

原创粉丝点击