CalculationWithDifferenceTpye

//date :2013 4 2
//designer pengxiaoen
//function : calculation with difference type to known how the computer do with the difference type

#include "stdio.h"
int main()
{
unsigned int i;
int j;
char k;

int unsigned_with_int,unsigned_with_char,int_with_char;

i = 10;
j = -5;
k = 12;

unsigned_with_int = i + j;
unsigned_with_char = i + k;
int_with_char = j + k;

printf ("unsigned_with_int = %d\n",unsigned_with_int);
printf ("unsigned_with_char = %d\n",unsigned_with_char);
printf ("int_with_char = %d\n",int_with_char);

system ("pause");
}

 

最终的结果:

全部正确。这就是传说中的运算时的double 类型转换?!

posted on 2013-04-02 11:22  清霜一梦  阅读(132)  评论(0编辑  收藏  举报