Chinaunix首页 | 论坛 | 博客
  • 博客访问: 149871
  • 博文数量: 91
  • 博客积分: 3010
  • 博客等级: 中校
  • 技术积分: 970
  • 用 户 组: 普通用户
  • 注册时间: 2009-06-09 11:40
文章分类
文章存档

2011年(1)

2010年(4)

2009年(86)

我的朋友
最近访客

分类: C/C++

2009-06-12 10:46:31

  整型(int,long,short)和浮点型(float,double)可以混合运算。遵循如下规则:
1.运算时,float型数据必定先转换为double型,short和char必定先转换为int。
    上次去某公司笔试时就考到了float型和int型运算后的结果,答案是double型。
2.int、unsigned、long、double之间的转化从左到右,即int和long运算时,int先转化为long型。
阅读(441) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~