类型转换

1.

c 语言没有指定char类型的变量是signed还是unsigned,所以当从char类型转化为int类型的时候,是有可能转化为负数的,这与机器相关,如果char类型的值的最左的一位为1,在某些机器中则转化为负数,在某些机器中则在最左端添零,转化为int时则为正数

2.

-1L < 1U,unsigned int提升为long

-1L > 1UL ,long被提升为unsigned long

3.

在math.h中使用的是双精度,float主要是在使用大数组时节省内存空间,节省时间,双精度运算特别费时

4.

in the absence of a function prototype, char and short
become int, and float becomes double. This is why we have declared function arguments to
be int and double even when the function is called with char and float

你可能感兴趣的:(类型转换)