Row Row Row Column Major order Col Col Col . Array of strings An array of strings is a two-dimensional character array. The size of the first index (rows) denotes the number of strings and the size of the second index (columns) denotes the maximum length of each string. Usually, array of strings are declared in such a way to accommodate the null character at the end of each string.
For example, the -D array has the declaration: char Name[ ][ ]; In the above declaration, the -D array has two indices which refer to the row size and column size, that is refers to the number of rows and refers to the number of columns. Chapter Page - - . . Initialization For example char Name[ ][ ] = {"Mr.
Bean", "Mr.Bush", "Nicole", "Kidman", "Arnold", "Jodie"}; In the above example, the -D array is initialized with strings, where each string is a maximum of characters long, since the last character is null. The memory arrangement of a -D array is shown below and all the strings are stored in continuous locations. r o M r . B e a n \ w M r .
B u s h \ s N i c o l e \ K i d m a n \ A r n o l d \ J o d i e \ Columns Name [ ][ ] Name [ ][ ] First index Second index Name [row] [column] = Name [ ] [ ] Name [ ][ ] # include<iostream> using namespace std; int main( ) // initialize 2d array char colour [ ][ ]={"Blue","Red","Orange", "yellow"}; // printing strings stored in 2d array for (int i= ; i < ; i++) cout << colour [i] << "\n"; Output: Blue Red Orange Yellow C++ program to demonstrate array of strings using -D character array Chapter Page - -