update dir

This commit is contained in:
light-city
2019-07-14 20:39:17 +08:00
parent 57627e0b75
commit fdf8d8eacb
8 changed files with 397 additions and 0 deletions

24
static/static_demo.cpp Normal file
View File

@@ -0,0 +1,24 @@
// the use of static Static
// variables in a Function
#include <iostream>
#include <string>
using namespace std;
void demo()
{
// static variable
static int count = 0;
cout << count << " ";
// value is updated and
// will be carried to next
// function calls
count++;
}
int main()
{
for (int i=0; i<5; i++)
demo();
return 0;
}