#include <stdio.h>
#include <stdlib.h>
//静态局部变量static
int f(int a)
{
int b = 0;//等价auto int b = 0;
static int c = 3;
b = b + 1;//b调用结束后,释放,再次调用时还是0+1
c = c + 1;//c是static局部变量,调用结束后并不释放,保留上次调用结束后的值;所以c的值依次为:3,3+1,4+1,5+1;
return (a + b + c);
}
static静态局部变量
最新推荐文章于 2022-04-01 08:50:11 发布