首页 > 代码库 > 网易云课堂_艾叔:零基础一站式C语言|C程序设计精讲_章节5整型_课时35整型基础

网易云课堂_艾叔:零基础一站式C语言|C程序设计精讲_章节5整型_课时35整型基础

 

C的10种数据类型

 

sizeof(char)=1
sizeof(unsigned char)=1
sizeof(short)=2
sizeof(unsigned short)=2
sizeof(int)=4
sizeof(unsigned int)=4
sizeof(long)=4
sizeof(unsigned long)=4
sizeof(long long)=8
sizeof(unsigned long long)=8
请按任意键继续. . .

 

#include <stdio.h>
#include <stdlib.h>

int main()
{
	printf("sizeof(char)=%zd\n", sizeof(char));
	printf("sizeof(unsigned char)=%zd\n", sizeof(unsigned char));

	printf("sizeof(short)=%zd\n", sizeof(short));
	printf("sizeof(unsigned short)=%zd\n", sizeof(unsigned short));

	printf("sizeof(int)=%zd\n", sizeof(int));
	printf("sizeof(unsigned int)=%zd\n", sizeof(unsigned int));

	printf("sizeof(long)=%zd\n", sizeof(long));
	printf("sizeof(unsigned long)=%zd\n", sizeof(unsigned long));

	printf("sizeof(long long)=%zd\n", sizeof(long long));
	printf("sizeof(unsigned long long)=%zd\n", sizeof(unsigned long long));

	system("pause");

	return 0;
}

 

网易云课堂_艾叔:零基础一站式C语言|C程序设计精讲_章节5整型_课时35整型基础