这个程序居然可以运行,请问why?
#include"stdio.h"#include"math.h"
void main()
{
int score;
char grade;
printf("Please input a score: ");
scanf("%d",&score);
grade=score>100?printf("输入错误"):(score>=90?'A':(score>=60?'B':(score>=0?'C':printf("输入错误"))));
printf("%c\n",grade);
}
难道printf函数可以夹在表达式里面一起用吗?
还有 printf("%c\n",grade); 改成 printf("%s\n",grade); 也能运行,但是会出错,why?