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

Function main

week04/examples/stringop.cpp:5–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3using namespace std;
4
5int main()
6{
7 char str1[] = "Hello, \0CPP";
8 char str2[] = "SUSTech";
9 char result[128];
10
11 for(int i = 0; i < 16; i++)
12 cout << i << ":" << +str1[i] << "(" << str1[i] << ")" << endl;
13
14 strcpy(result, str1);
15 cout << "Result = " << result << endl;
16 strcat(result, str2);
17 cout << "Result = " << result << endl;
18
19 cout << "strcmp() = " << strcmp(str1, str2) << endl;
20
21 //strcat(str1, str2); //danger operation!
22 //cout << "str1 = " << str1 << endl;
23}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected