Skip to content

Commit 16dc166

Browse files
committed
add c/c++ lib struct char compare
1 parent 0061b4b commit 16dc166

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/c/struct_lib.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,9 @@ if (s.Lmy_char != 5) {
3030
exit(EXIT_FAILURE);
3131
}
3232

33+
if (strcmp(s.my_char, "Hello") != 0) {
34+
fprintf(stderr, "Error: my_char != Hello: %s\n", s.my_char);
35+
exit(EXIT_FAILURE);
36+
}
37+
3338
}

src/cxx/struct_lib.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,9 @@ if (s.Lmy_char != 5) {
2929
exit(EXIT_FAILURE);
3030
}
3131

32+
if (strcmp(s.my_char, "Hello") != 0) {
33+
std::cerr << "Error: my_char != Hello " << s.my_char << std::endl;
34+
exit(EXIT_FAILURE);
35+
}
36+
3237
}

0 commit comments

Comments
 (0)