MCPcopy Create free account
hub / github.com/ShiqiYu/CPP / main

Function main

week05/examples/pointer.cpp:5–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3using namespace std;
4
5int main()
6{
7 int num = 10;
8 int * p1 = NULL, * p2 = NULL; // declaration, initialize to 0
9 p1 = # // take the address of num, assign to p1
10 p2 = # // take the address of num, assign to p2
11
12 cout << "num = " << num << endl;
13
14 *p1 = 20; // assign to num
15 cout << "num = " << num << endl;
16
17 *p2 = 30; // assign to num
18 cout << "num = " << num << endl;
19
20 return 0;
21}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected