初学者请教个关于隐式类型转换问题
在学习隐式类型转换时我遇到编译器显示出来的结果和书中的不一样。。。。代码如下:
#include<stdio.h>
#define true 1
#define false 0
int main(void)
{
//Local Declarations
bool b = true;
char c = 'A';
float d = 245.3;
int i = 3650;
short s = 78;
//Statements
printf("bool + char is char: %c\n",b + c);
printf("int * short is int: %d\n",i * s);
printf("float * char is float: %f\n",d * c);
c = c + b;
d = d + c;
b = false;
b = -d; //float 在此时应该降级为 bool了呀
printf("\nAfter execution...\n");
printf("char + ture is char: %c\n",c);
printf("float + char is float: %f\n",d);
printf("bool = -float: %f\n",b);
return 0;
}//main
其中关于最后一句
编译器给出的结果是bool = -float:0.000000
而书中给出的结果是bool = -float:1
各位大虾看看是怎么回事。。。小弟看了半天也没搞懂。。