当前位置:网站首页>初识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. 类型的使用

边栏推荐
猜你喜欢

李宏毅机器学习组队学习打卡活动day01---机器学习介绍

如何快速有效解决数据库连接失败问题

The concept of cloud native application and 15 characteristics of cloud native application

Li Hongyi machine learning team learning punch in activity day06 --- convolutional neural network

String class

李宏毅机器学习组队学习打卡活动day02---回归

Message reliability processing

JVM part I: memory and garbage collection part II -- class loading subsystem

小米商城项目_注册

李宏毅机器学习组队学习打卡活动day06---卷积神经网络
随机推荐
BIO、NIO、AIO区别
Differences and examples between internal classes and static internal classes
SQL database → constraint → design → multi table query → transaction
322 coin change of leetcode
项目登录注册思路
pytorch 数据类型 和 numpy 数据 相互转化
Day6 --- SQLAlchemy进阶
如何快速上手强化学习?
李宏毅机器学习组队学习打卡活动day02---回归
Redis persistence
p7 day1 初识Flask框架
Idea remote debugging
Three waiting methods of selenium and three processing methods of alert pop-up
用户的管理-限制
图片上传的逻辑
Flask的传参以及返回的响应
枚举类实现单例模式
如何快速有效解决数据库连接失败问题
登录到主页功能实现
The interface can automatically generate E and other asynchronous access or restart,