Sometime it is a little bit confusing when using cstring and string class.
cstring is a sequence of characters ended with null "\0" terminator, stored as an array.
C++std::string is a class.
Following are varieties of ways to declare a cstring:
char ch1[30] ="first cstring";
char ch2[] ="this is a cstring";
char* ch3 = "this is third cstring";
char* ch4 = new char[50];
The following is how to declare a char
No comments:
Post a Comment