MCPcopy Create free account
hub / github.com/EricPengShuai/Interview / main

Function main

base_code/static.cpp:6–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4int i = 1; // i 为全局变量,具有静态生存期
5
6int main()
7{
8 static int a; // 静态局部变量,有全局寿命,局部可见
9 int b = -10; // b, c 为局部变量,具有动态生存期
10 int c = 0;
11 void other();
12
13 cout << "---MAIN---\n";
14 cout << " i: " << i << " a: " << a << " b: " << b << " c: " << c << endl; // 1 0 -10 0
15 c = c + 8;
16 other(); // 33 4 0 15
17
18 cout << "---MAIN---\n";
19 cout << " i: " << i << " a: " << a << " b: " << b << " c: " << c << endl; // 33 0 -10 8
20 i = i + 10;
21 other(); // 75 6 4 15
22 other(); // 107 8 6 15
23 return 0;
24}
25
26void other()
27{

Callers

nothing calls this directly

Calls 1

otherFunction · 0.85

Tested by

no test coverage detected