Accessing Elements of Array of Pointers to Strings
We can access the strings stored in this array using their index value as usual:
array_name[i]
where i is the index of the string.
Moreover, we can even access the character of a particular string by treating this array as 2d array.
array_name[i][j]
where j is the index of the character.
We can also use the pointer representation for accessing the character
*(array_name[i] + j)
or even treat the array as pointer too.
*(*(array_name + i) + j)
The above is a property of array and is same for all other types of array. To learn more, visit – C++ Arrays
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++.