其他分享
首页 > 其他分享> > 0012 列出系统数据类型大小

0012 列出系统数据类型大小

作者:互联网

// 名称:0012 列出系统数据类型大小
// 作者:丁进
// 时间:2021.2.14
// 描述:计算出当前系统各种数据类型占用的字节数

#include <stdio.h>
int main()
{
	printf("short _________________字节数: %d\n", sizeof(short));
	printf("int ___________________字节数: %d\n", sizeof(int));
	printf("long __________________字节数: %d\n", sizeof(long));
	printf("long long _____________字节数: %d\n", sizeof(long long));
	printf("float _________________字节数: %d\n", sizeof(float));
	printf("double ________________字节数: %d\n", sizeof(double));
	printf("long double ___________字节数: %d\n", sizeof(long double));
	printf("char __________________字节数: %d\n\n", sizeof(char));

	printf("unsigned short ________字节数: %d\n", sizeof(unsigned short));
	printf("unsigned int __________字节数: %d\n", sizeof(unsigned int));
	printf("unsigned long _________字节数: %d\n", sizeof(unsigned long));
	printf("unsigned long long ____字节数: %d\n", sizeof(unsigned long long));
}
short __________________字节数: 2
int ____________________字节数: 4
long ___________________字节数: 4
long long ______________字节数: 8
float __________________字节数: 4
double _________________字节数: 8
long double ____________字节数: 8
char ___________________字节数: 1

unsigned short _________字节数: 2
unsigned int ___________字节数: 4
unsigned long __________字节数: 4
unsigned long long______字节数: 8

标签:0012,字节数,int,数据类型,unsigned,long,printf,sizeof,列出
来源: https://blog.csdn.net/m0_51439429/article/details/113811976