string

Hi.
How does 'string' differ from 'String' and 'const char *'?
const char * is a pointer to a location of unchanging characters. std::string is a typedef for basic_string<char> for manipulating and handling strings. idk where you saw String but its not standard
A 'const char *' is just a constant pointer to the memory location of a character or characters. If you include <string.h> aka <cstring>, you will be able to use a few functions that allow you do some common tasks on these characters. These are called C-Strings, and it should be noted that the last character in a C-String must be the null character.
http://www.cplusplus.com/reference/cstring/

A 'string' is the C++ equivalent of a C-String. It is much easier to use.
http://www.cplusplus.com/reference/string/

A 'String' sounds like someone's personal implementation of a string. It's not in the standard template library.
Topic archived. No new replies allowed.