C语言:算术转换。

如果某个操作符的各个操作数属于不同的类型,那么除非其中一个操作数的转换为另一个操作数的类
型,否则操作就无法进行。下面的层次体系称为寻常算术转换。

	printf("%u\n", sizeof(long double));//打印8
	printf("%u\n", sizeof(double));//8
	printf("%u\n", sizeof(float));//4
	printf("%u\n", sizeof(unsigned long int));//4
	printf("%u\n", sizeof(long int));//4
	printf("%u\n", sizeof(unsigned int));//4
	printf("%u\n", sizeof(int));//4

如果某个操作数的类型在上面这个列表中排名较低,那么首先要转换为另外一个操作数的类型后执行运算。

猜你喜欢

转载自blog.csdn.net/weixin_45275802/article/details/112569873