Share this:
Strings
In C++ strings are really arrays, but there are some different functions that are used for strings, like adding to strings, finding the length of strings, and also of checking to see if strings match.
The definition of a string would be anything that contains more than one character string together. For example, “This” is a string. However, single characters will not be strings, though they can be used as strings.
Strings are arrays of chars. Static strings are words surrounded by double quotation marks.
“This is a static string”
To declare a string of 50 letters, you would want to say:
char string[50];
This would declare a string with a length of 50 characters. Do not forget that arrays begin at zero, not 1 for the index number. In addition, a string ends with a null character, literally a ‘