c语言中各个类型的sizeof长度
#include <stdio.h>
int main()
{
printf("\nA Char is %lu bytes", sizeof( char ));
printf("\nAn int is %lu bytes", sizeof( int ));
printf("\nA short is %lu bytes", sizeof( short ));
printf("\nA long is %lu bytes", sizeof( long ));
printf("\nA long long is %lu bytes\n", sizeof( long long ));
printf("\nAn unsigned Char is %lu bytes", sizeof( unsigned char ));
printf("\nAn unsigned int is %lu bytes", sizeof( unsigned int));
printf("\nAn unsigned short is %lu bytes", sizeof( unsigned short ));
printf("\nAn unsigned long is %lu bytes", sizeof( unsigned long ));
printf("\nAn unsigned long long is %lu bytes\n",sizeof( unsigned long long ));
printf("\nfloat is %lu bytes", sizeof( float ));
printf("\nA double is %lu bytes\n", sizeof( double ));
printf("\nA long double is %lu bytes\n", sizeof( long double ));
return ;
}
muhuacat@muhuacat:~/bin# gcc -o c c.c
muhuacat@muhuacat:~/bin# ./c A Char is bytes
An int is bytes
A short is bytes
A long is bytes
A long long is bytes An unsigned Char is bytes
An unsigned int is bytes
An unsigned short is bytes
An unsigned long is bytes
An unsigned long long is bytes float is bytes
A double is bytes A long double is bytes
c语言中各个类型的sizeof长度的更多相关文章
- C语言中不同类型的循环(Different types of loops in C)
C语言中有三种类型的循环:for,while,do-while. while循环先判断循环条件. while (condition) { //gets executed after condition ...
- C++语言中的类型(二)
--分门别类是简化事物最有效的方式. C++语言的强大能力的体现在对程序员自定义数据类型的支持.C++语言主要的一个设计目标就是让程序员自定义的数据类型像内置类型一样好用. 一.自定义数据类型 数据类 ...
- C++语言中的类型(一)
--分门别类是简化事物最有效的方式. 类型是C++语言的基础,对象类型决定了能对该对象进行的操作. 一.基本内置数据类型 C++预先定义的基本内置数据类型是构造世界万物的原子,数据类型告诉我们数据的意 ...
- 关于JAVA中String类型的最大长度
前些天看到一道面试题,题目很容易理解:String的长度限制是多少? 针对这个题目,浏览了网友的回答,大概得到了3个层次的答案. 最浅的层次: 近似计算机内存大小的长度.这是作为一个程序员最浅显的回答 ...
- C语言中不同类型的数据转换规则
不同类型数据间的混合运算与类型转换 1.自动类型转换 在C语言中,自动类型转换遵循以下规则: ①若参与运算量的类型不同,则先转换成同一类型,然后进行运算 ②转换按数据长度增加的方向进行,以保证精度不降 ...
- C#语言中的类型转换方法(unfinished)
一.C#中的数据类型 1.数值类型 2.字符类型 3.字符串类型 4.布尔类型 5.枚举类型 6.Object类型 二.常见的类型转换 从转换方式的角度,类型转换分为隐式转换与显式转换两种. 其中,隐 ...
- php弱类型语言中的类型判断
1.php一个数字和一个字符串进行比较或者进行运算时,PHP会把字符串转换成数字再进行比较.PHP转换的规则的是:若字符串以数字开头,则取开头数字作为转换结果,若无则输出0. 例如:123abc转换后 ...
- 关于C语言中不同类型数据进行计算 有符号和无符号数进行计算
float是8个有效位, 做个试验: 输出如下: 上面说明了什么: 1, 18/2.2 是除不尽的, 因为是define,所以没有给ratio变量赋值类型,但是从sizeof输出的结果是8,所以系统默 ...
- Go 语言中的方法,接口和嵌入类型
https://studygolang.com/articles/1113 概述 在 Go 语言中,如果一个结构体和一个嵌入字段同时实现了相同的接口会发生什么呢?我们猜一下,可能有两个问题: 编译器会 ...
随机推荐
- iOS符号表
https://docs.bugtags.com/zh/symbols/ios/find.html 发红包的限制 1.发送频率规则 ◆ 每分钟发送红包数量不得超过1800个: ◆ 同一个商户号,每分钟 ...
- class属性中为什会添加非样式的属性值?
来由 在一些插件中经常看到, 在class属性中出现一些跟样式无关的属性值, 这些值在css样式中没有对应定义, 但是在js中会根据这个值来给dom对象添加特殊的行为, 例如: jquery vali ...
- Java基础之写文件——将素数写入文件中(PrimesToFile)
控制台程序,计算素数.创建文件路径.写文件. import static java.lang.Math.ceil; import static java.lang.Math.sqrt; import ...
- Python:操作文件
python操作文件库不需要安装其他module,文件操作类库是python语言自身支持的操作. 判定文件是否存在:os.path.isfile(filePath) import os import ...
- jeasyui datagrid 使用记
1. 一开始想用$('#dg').datagrid('getChanges')来保存整个table修改的行, 结果发现当前编辑的行不算,要失去焦点才有记录 2. 然后改用 $('#dg') ...
- Leetcode: Arithmetic Slices
A sequence of number is called arithmetic if it consists of at least three elements and if the diffe ...
- 认真学习shell的第一天-数学运算
shell中的数学运算有三种方式: (1)let,用let的时候,变量名称前不用添加$ (2)[],[]中变量可使用也可不使用$ (3)(())变量名之前必须添加$
- codeforces 446C DZY Loves Fibonacci Numbers(数学 or 数论+线段树)(两种方法)
In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation F1 ...
- linux扩大swap交换空间
有两种解决方法:一是创建新的swap分区;另一则是创建swap文件 创建swap文件如果你的硬盘空间已经全部分配给其他分区,也没有多余的预算新添购硬盘,我们可以利用swap文件的方式增加虚拟的swap ...
- PHP漏洞全解(详细介绍)
转载 http://www.jb51.net/article/31898.htm 针对PHP的网站主要存在下面几种攻击方式: 1.命令注入(Command Injection) 2.eval注入(E ...