File tree Expand file tree Collapse file tree
source/chpt_1_ACppPrimer/print Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33hello :)
44
5+ https://bcs.wiley.com/he-bcs/Books?action=index&itemId=0470383275&bcsId=6384
6+
57https://code.visualstudio.com/docs/cpp/config-linux#_debug-helloworldcpp
68
79https://clang.llvm.org/docs/ClangFormatStyleOptions.html
Original file line number Diff line number Diff line change 1+ #include < iostream>
2+
3+ // Pass by value
4+ void print_a (int x) {
5+ std::cout << " print(int x): " << ++x << std::endl;
6+ }
7+
8+ // Pass by reference
9+ void print_b (int & x) {
10+ std::cout << " print(int& x): " << ++x << std::endl;
11+ }
12+
13+ int main (int argc, char const * argv[]) {
14+ int num = 5 ;
15+ std::cout << " num = " << num << std::endl << std::endl;
16+
17+ print_a (num);
18+ std::cout << " num = " << num << std::endl << std::endl;
19+
20+ print_b (num);
21+ std::cout << " num = " << num << std::endl << std::endl;
22+
23+ return 0 ;
24+ }
You can’t perform that action at this time.
0 commit comments