伪命题,静态局部变量可以当做函数参数。
举个反例推翻该命题:
#include <stdio.h>
void f(int n)
{
printf("%d", n*n);
}
int main()
{
static int n=2;
f(n); //n是静态局部变量,OK
return 0;
}
追问emmmmmm..这是书上的题目。。
追答要么是你描述的不对,要么那书呵呵了
#include <stdio.h>
void f(static int n) //这样都可以,虽然没什么用
{
printf("%d", n*n);
}
int main()
{
static int n=2;
f(n); //n是静态局部变量,OK
return 0;
}