previous |
start |
next
Pointers to Character Strings
- C++ inherits a more primitive level of string
handling from the C language, in which strings are represented as
arrays of char values.
- We don't recommend that you use character
pointers or arrays in your programs, but you occasionally need to
interface with functions that receive or return char*
values.
char s[] = "Harry";
|
s[0]
|
s[1] |
s[2] |
s[3] |
s[4] |
s[5] |
| 'H' |
'a' |
'r' |
'r' |
'y' |
'\0' |
- Literal strings are
stored inside char arrays.
previous |
start |
next