为什么以下代码运行while循环?我认为"mid = term"是一项任务,而不是条件?请解释.谢谢.
#include <stdio.h>
main ()
{
int mid = 4, term = 4;
while ( mid = term)
printf("%d\n", --term);
}
Run Code Online (Sandbox Code Playgroud) 这个程序的第7行不是"pay = prt(pay);" 应该抛出编译或运行时错误,因为它将int传递给需要double的param?我用dev-c ++编译好了,用两行输出运行程序.请解释一下,谢谢.
#include <stdio.h>
int prt(double b);
main ()
{
int pay = 3;
double tax = 2.2;
pay = prt(pay);
prt(tax);
}
int prt(double b)
{
b *= 2;
printf("%.2lf\n", b);
}
Run Code Online (Sandbox Code Playgroud)