Since these strings are really just arrays, we can access each
character in the array using subscript notation, as in:

cout << "Third char is: " << label[2] << endl;

which prints out the third character, n.

A disadvantage of creating strings using the character array
syntax is that you must say ahead of time how many characters
the array may hold. For example, in the following array definitions, we
state the number of characters (either implicitly or explicitly) to be
allocated for the array.

char label[] = "Single"; // 7 characters
char label[10] = "Single";

Thus, you must specify the maximum number of characters you will ever
need to store in an array. This type of array allocation, where the
size of the array is determined at compile-time, is called static
allocation.

Strings as pointers:

Another way of accessing a contiguous chunk of memory, instead
of with an array, is with a pointer.

Since we are talking about strings, which are made up
of characters, we'll be using pointers to characters,
or rather, char *'s.

However, pointers only hold an address, they cannot hold all the
characters in a character array. This means that when we use a
char * to keep track of a string, the character array
containing the string must already exist (having been either
statically- or dynamically-allocated).

Below is how you might use a character pointer to keep track
of a string.

Basically, we've just asked new (the allocation operator)
to give us back enough space for an array of the desired size.
Operator new requires the type of elements (here,
char) and the number of elements needed (given as the
array size between [ and ]).

Note that unlike static allocation, e.g.:

char name[20];

the size can be variable (when using new for allocation).

We keep track of the dynamically-allocated array with a pointer (e.g.,
the return value of the call to new is stored in
str).We then can use that pointer as we used pointers to
statically-allocated arrays above (i.e., we access individual
characters with str[i], pass the string to a function,
etc.).

Finally, note that when we are done using the string, we must
deallocate it.

Note:
Note the use of [] when using delete to
deallocate an array.

Here, we deallocate the string in the same function, but in some cases
we might still need it after SomeFunc() ends, so we'd
deallocate it later. Remember, we must keep a pointer to the beginning
of the string because that's what is used to access the string and
to deallocate it.

Arrays vs. Pointers:

As we can now see, there is more than one way to view a
string. A string might be accessed in a statically-allocated
array, it might be accessed via a pointer to a statically-allocated
array, or perhaps via a pointer to a dynamically-allocated array.