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

Method setName

week09/examples/firstclass.cpp:10–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8 int born;
9 bool male;
10 void setName(const char * s)
11 {
12 if (s == NULL)
13 {
14 std::cerr << "The input is NULL." << std::endl;
15 return;
16 }
17 size_t len = sizeof(name) - 1;
18 strncpy(name, s, len);
19 name[len] = '\0';
20 }
21 void setBorn(int b)
22 {
23 if (b >= 1990 && b <= 2020 )

Callers 1

mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected