-
Notifications
You must be signed in to change notification settings - Fork 940
Expand file tree
/
Copy pathmain.cpp
More file actions
26 lines (22 loc) · 848 Bytes
/
main.cpp
File metadata and controls
26 lines (22 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "../exercise.h"
// READ: <https://stackoverflow.com/questions/156767/whats-the-difference-between-an-argument-and-a-parameter>
// THINK: 参数都有哪些传递方式?如何选择传递方式?
void func(int);
// TODO: 为下列 ASSERT 填写正确的值
int main(int argc, char **argv) {
auto arg = 99;
ASSERT(arg == 99, "arg should be 99");
std::cout << "befor func call: " << arg << std::endl;
func(arg);
ASSERT(arg == 99, "arg should be 99");
std::cout << "after func call: " << arg << std::endl;
return 0;
}
// TODO: 为下列 ASSERT 填写正确的值
void func(int param) {
ASSERT(param == 99, "param should be 99");
std::cout << "befor add: " << param << std::endl;
param += 1;
ASSERT(param == 100, "param should be 100");
std::cout << "after add: " << param << std::endl;
}