c语言中类型提升优先级,C语言中的类型提升和扩展

这篇博客详细阐述了在运算中不同类型数值的转换规律,包括long double、double、float之间的转换,以及整数类型的提升和不同整数类型间的转换,特别是unsigned long int、long int和unsigned int之间的转换策略。
摘要由CSDN通过智能技术生成

总之,朝表示范围大的方向扩展:

First, if either operand is long double, the other is converted to long double.

Otherwise, if either operand is double, the other is converted to double.

Otherwise, if either operand is float, the other is converted to float.

Otherwise, the integral promotions are performed on both operands; then, if either operand is unsigned long int, the other is converted to unsigned long int.

Otherwise, if one operand is long int and the other is unsigned int, the effect depends on whether a long int can represent all values of an unsigned int; if so, the unsigned int operand is converted to long int; if not, both are converted to unsigned long int.

Otherwise, if one operand is long int, the other is converted to long int.

Otherwise, if either operand is unsigned int, the other is converted to unsigned int.

Otherwise, both operands have type int.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值