MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / main

Function main

Examples/NoModules/Chapter 08/Ex8_07.cpp:7–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5void change_it_by_reference(double& reference_to_it); // Pass by reference
6
7int main()
8{
9 double it {5.0};
10
11 change_it_by_pointer(&it); // Now we pass the address
12 std::cout << "After first function execution, it = " << it << std::endl;
13
14 change_it_by_reference(it); // Now we pass a reference, not the value!
15 std::cout << "After second function execution, it = " << it << std::endl;
16}
17
18void change_it_by_pointer(double* pit)
19{

Callers

nothing calls this directly

Calls 2

change_it_by_pointerFunction · 0.70
change_it_by_referenceFunction · 0.70

Tested by

no test coverage detected