c语言中 int类型等
来源:互联网 发布:动迁三块砖算法 编辑:程序博客网 时间:2024/06/10 21:59
ANSIC标准里是没有规定占多少字节的,准确地说与你的计算机CPU位数和操作系统位数无关,类型大小是由编译器厂商compiled时定义的,具体你可以在你编译器sizeof看一下。
那么一般是多少字节的呢?
int long float double char
16位:2 2 2 4 1,
32位:4 4 4 8 1
可用以下例子测试:
#include"stdio.h"
int main()
{
printf("the size of int is %d\n",sizeof(int));
printf("the size of long is %d\n",sizeof(long));
printf("the size of float is %d\n",sizeof(float));
printf("the size of double is %d\n",sizeof(double));
}
用gcc -o test test.c
结果:#include"stdio.h"
the size of int is 4
the size of long is 4
the size of float is 4
the size of double is 8
32位:4 4 4 8 1
可用以下例子测试:
#include"stdio.h"
int main()
{
printf("the size of int is %d\n",sizeof(int));
printf("the size of long is %d\n",sizeof(long));
printf("the size of float is %d\n",sizeof(float));
printf("the size of double is %d\n",sizeof(double));
}
用gcc -o test test.c
结果:#include"stdio.h"
the size of int is 4
the size of long is 4
the size of float is 4
the size of double is 8
- c语言中 int类型等
- C语言中基本类型char、short、int、long等类型的取值范围
- C语言中基本类型char、short、int、long等类型的取值范围
- c语言中int long float double 等类型所占字节及输出表示
- c语言中char类型转int类型
- C语言中的int类型
- C语言中int 类型的字节长度
- C语言中int到float的强制类型转换
- C语言中int,duoble数据转换为char类型
- C语言中int到float的强制类型转换
- C语言中类型转换:char转unsigned int
- C语言中byte类型与int类型转换与移位小细节记录
- c语言指针与int类型相加
- C语言强制类型转换 int ->float
- C 和 JAVA 中字符串和int等其他类型互相转换
- C语言中判断int,long型等变量是否赋值的方法
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- shell 替换文件内容
- C++资料
- JQuery让input从disabled变成enabled
- 今天是2011年7月18日
- struts2.0的标签库(简介)
- c语言中 int类型等
- 一个Delphi下Abstract Error问题的处理
- 关于在无限制条件下弹簧振子的运动轨迹
- VSS6.0的安装及使用以及在Myeclipse配置
- 关于有重根情况下微分方程根的一般形式
- Oracle 安装规划
- 使用DBCA创建数据库
- 调试Android 2.2的wm8976的驱动用于支持3G的心得
- 初始化参数概览