有以下程序:
#include <stdio.h>
int f(int x);
main( )
{ int a,b=0;
for(a=0;a<3;a+=1)
{ b+=f(a); putchar(´A´+b); }
}
int f(int x)
{ return x*x+1; }
程序运行后的输出结果是
在函数 main( )中, 第一次执行 for 循环时, b 的值等于 1, 此时输出字母 B;第二次执行 for 循环时, b 的值等于 3, 此时输出字母 D; 第三次执行 for 循环时, b 的值等于 8, 此时输出字母 I。 因此 C 选项正确。