C语言中的—数据类型(第10篇)

慢慢来,比较快


一、数据类型

在这里插入图片描述

二、C语言 有没有 字符串类型

答:没有字符串类型

三、每种 数据类型 的 大小 是多少?

在这里插入图片描述

#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;
}
char1
short2
int4
long4
long long8
float4
double8
long double8

1. 为什么 int 和 long 的数据类型大小都是 4 字节?

C语言规定:sizeof(long) >= sizeof(int)
只要 long 的数据类型是比 int 大就可以了

2.字节有多大?

bit比特位
byte字节
1 byte8 bit
KB1024 byte
MB1024 KB
GB1024 MB
TB1024 GB
PB1024 TB

四、总结

存在这么多的类型,其实是为了更加丰富的表达生活中的各种值。

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值