C语言试题 收集

来源:互联网 发布:淘宝福利买家秀关键词 编辑:程序博客网 时间:2024/05/17 02:48
#include "stdio.h"
#include "conio.h"
 
 main()
{
int a=1,b=2,c=2;
while(a<b<c)
{
  int t;
  t=a;
  a=b;
  b=t;
  c--;
}
  printf("%d /n",c);
  getch();
}


 

自己尝试着把结果写下来
 
 
如果想知道正确答案 就去编译器上自己运行下
 
 
C99规范
§6.5.9 第86页 89) The expression a<b<c is not interpreted as in ordinary mathematics. As the syntax indicates, it
means (a<b)<c; in other words, ‘‘if a is less than b, compare 1 to c; otherwise, compare 0 to c’’
原创粉丝点击