华为面试题:关于sizeof的问题!

gezichong 2008-02-26 09:21:07
请问:
sizeof(int),sizeof(long),sizeof(double)在16位机,32位机,64位机中各等于什么?

谢谢!
...全文
1354 41 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
41 条回复
切换为时间正序
请发表友善的回复…
发表回复
mymtom 2008-04-15
  • 打赏
  • 举报
回复
NNGX,
华为居然出这种面试题?
实在是太失望了.
chenhj_wo 2008-04-15
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 Chiyer 的回复:]
C/C++ code
int
Type int is an integral type that is larger than or equal to the size of type short int, and shorter than or equal to the size of type long.

long
Type long (or long int) is an integral type that is larger than or equal to the size of type int.

double
Type double is a floating type that is larger than or equal to type float, but shorter than or equal to the size of t…
[/Quote]


我投它为最标准答案
lvzehong 2008-04-15
  • 打赏
  • 举报
回复
16 位:2 2 4
32 位:4 4 8
64 位:8 8 16
(在VC++编译器下)
yvhkpgf 2008-04-15
  • 打赏
  • 举报
回复
华为真无聊呀
Secrete_Hunter 2008-04-15
  • 打赏
  • 举报
回复
无聊啊~
lxjlan 2008-04-15
  • 打赏
  • 举报
回复
这个说不准的,除了看机器的类型的,还需考虑编译器类型的。。
例如:winxp是32位的系统,它可以以兼容方式运行,turboc2.0这样的编译器,而turbo c是16位的编译器。
aayzaayz 2008-04-07
  • 打赏
  • 举报
回复
sizeof(double) = 字长 * 2
sizeof(int) = 字长
hj_etone 2008-03-01
  • 打赏
  • 举报
回复
无聊的题目,就算不确定,在通过测试一下不就知道了。一点技术含量都没有
polarbear2008 2008-03-01
  • 打赏
  • 举报
回复
也许答案本身并不是目的
PurpleAxis 2008-02-29
  • 打赏
  • 举报
回复
是多少位的机子是看一个字长是几位,你自己想吧,应该不难的。一个字长是两个字节。
xadream 2008-02-29
  • 打赏
  • 举报
回复
不一定的 16位机的 int 也可以定义为8字节
zh1369 2008-02-29
  • 打赏
  • 举报
回复
sizeof(int),sizeof(long),sizeof(double)在16位机,32位机,64位机中各等于什么?
---
和编译器相关.
大米无糖 2008-02-29
  • 打赏
  • 举报
回复
关注 ,

我只知道 32位上 , int 4, char 1, double 8 long 4

64位上用VC 值也是这样。
山之魂2 2008-02-29
  • 打赏
  • 举报
回复
虽然大家觉得很无聊,但是华为是做通讯的,这个对他们是必须的
yixuan178 2008-02-28
  • 打赏
  • 举报
回复
gcc version 4.1.2 20070115 (prerelease) (SUSE Linux)
和上面结果一样。
short int long double
2 4 4 8
yixuan178 2008-02-28
  • 打赏
  • 举报
回复
vs2005,windows xp
short int long double
2 4 4 8
lucian2007 2008-02-28
  • 打赏
  • 举报
回复
编译器决定,我想这不是个好问题。
jeckpc 2008-02-28
  • 打赏
  • 举报
回复
应该是由CPU的字长决定的吧~!
kaicaitaiyang 2008-02-28
  • 打赏
  • 举报
回复
不确定的东西怎么考呀?
netmankind 2008-02-28
  • 打赏
  • 举报
回复
完全由编译器决定
加载更多回复(21)

70,024

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧