单选题 C语言
题号 #2273272

有以下程序:
#include<stdio.h>
int f(int m)
{  static int n=0;
 n+=m;
 return n;
}
main(  )
{ int n=0;  
 printf("%d,"f(++n));
 printf("%d\n",f(n++));
}
程序运行后的输出结果是(  )。   

进入在线模考

参考答案

A

答案解析

由题可知,输出是调用了f函数,其中有f(++n)和f(n++),其中n=0,所以输出的结果为l,2。

你可能感兴趣的试题

找试题 · 找答案 · 找资料 在线模考