变量作用域
#include<iostream>
void print();
int main()
{
char a=0;
for(a=0;a<20;a++)
print();
return 0;
}
void print()
{
static int x=0;//静态变量声明,其值会一直保留
x++;
std::cout<<x<<std::endl;
}#include<iostream>
void print();
int main()
{
char a=0;
for(a=0;a<20;a++)
print();
return 0;
}
void print()
{
static int x=0;//静态变量声明,其值会一直保留
x++;
std::cout<<x<<std::endl;
}本教程内所有代码均不包含运行的结果,请大家先看https://www.myfpga.cn/?id=9https://www.myfpga.cn/?id=11...
#include<iostream> using namespace std; int main() { cout << "The size of int is&nb...