Array of Pointers to Strings in C++
A pointer to a string means that the pointer points to the first character in the sequence of characters that is terminated by a null character. In C++, we can use this pointer to represent strings.
An array of pointers to strings will simply be an array whose each element is a pointer that points to a string. We can also visualize this array as a 2D array of characters where each row contains a string and its size is also equal to that string.
To create an array of pointers to strings in C++, we declare an array of pointer types where each element points to a character.
Array of Pointers to Strings in C++
In C++, an array is a homogeneous collection of data that is stored in a contiguous memory location. We can store almost all types of data as array elements. In this article, we will learn how to store the array of pointers to strings in C++.