I am reading Googletest doc, and I am learning that there is one syntax for comparing string, and another for comparing C string. I dont see what is referred to as C string and as string. How are these different?
Asked
Active
Viewed 5,377 times
2 Answers
12
If you try to use ASSERT_EQ
to C-Strings, you only compare two pointers, but not really null-terminated C-Strings. For that exists ASSERT_STREQ
syntax.

Yu Hao
- 119,891
- 44
- 235
- 294

Aleksey Bakin
- 1,506
- 13
- 27
2
std::string
is often called C++ string
. Using strings like
const char *text = "text";
is called CStrings.
much more information can be found here:
What is the difference between char * const and const char *?