当前位置:网站首页>初识C语言——常见的数据类型
初识C语言——常见的数据类型
2022-07-27 05:03:00 【yin_尹】
C语言中常见的数据类型都有哪些?
char //字符数据类型
short //短整型
int //整形
long //长整型
long long //更长的整形
float //单精度浮点数
double //双精度浮点数
1. 为什么出现这么多的类型?
存在这么多的类型,其实是为了更加丰富的表达生活中的各种值。不同的数据可以用不同的类型来表示。
2. 每种类型的大小是多少?
可以使用sizeof操作符来计算不同数据类型所占空间的大小
#include <stdio.h>
int main()
{
printf("%d\n", sizeof(char));
printf("%d\n", sizeof(short));
printf("%d\n", sizeof(int));
printf("%d\n", sizeof(long));
printf("%d\n", sizeof(long long));
printf("%d\n", sizeof(float));
printf("%d\n", sizeof(double));
printf("%d\n", sizeof(long double));
return 0; }

3. 类型的使用

边栏推荐
猜你喜欢
随机推荐
如何将Excel表格中的多列内容合并到一列
简化JDBC的MyBits框架
Graph cuts learning
Localdatetime and zoneddatetime
李宏毅机器学习组队学习打卡活动day06---卷积神经网络
后台频道组管理功能实现
用户的管理-限制
How to view the evaluation of tutors
Day6 --- SQLAlchemy进阶
稀疏数组→五子棋的存盘续盘等操作
The receiver sets the concurrency and current limit
pytorch中几个难理解的方法整理--gather&squeeze&unsqueeze
Niuke sword refers to the path in the offer--jz12 matrix
String class
Li Hongyi machine learning team learning punch in activity day03 --- error and gradient decline
如何快速有效解决数据库连接失败问题
mq常见问题
DNSmasq使用总结
B1027 print hourglass
订单系统功能实现



![[optical flow] - data format analysis, flowwarp visualization](/img/7d/2fefc32813ec0c93115e4b290b0944.png)





