Static storage type

CSDN Q & A 2022-05-15 04:41:59 阅读数:475

staticstoragetype

#include <stdio.h>
float f(float x)
{ static float y;
y+=x*x;
return y;
}
int main()
{ int i;
for(i=2;i<=4;i++) printf("i=%d,f=%.2f\n",i,f((float)i));
}
first f If it's worth it, I'm not right How does the first one count 🥺




Take the answer :

static float y; The default initial is 0.

first f value :y=0+2.0*2.0;


版权声明:本文为[CSDN Q & A]所创,转载请带上原文链接,感谢。 https://primo.wiki/2022/131/202205041902516944.html