标题:有点不明白
取消只看楼主
jhhxxx
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2008-7-23
结帖率:0
已结贴  问题点数:10 回复次数:0 
有点不明白
32. What will be the result of the following program?
main()
{char p[]="String";
int x=0;
if(p=="String")
{printf("Pass 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
else
{
printf("Fail 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
}
最终的结果 Fail 1, Pass 2,而printf("%s",p);出来的结果就是string  为什么会出faile1  if(p=="String")
搜索更多相关主题的帖子: will following result 
2010-05-28 15:35



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-308504-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.599761 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved