An array of pointers to strings - C++ Data Type

C++ examples for Data Type:Array Pointer

Description

An array of pointers to strings

Demo Code

#include <iostream>
using namespace std;
const int DAYS = 7;             //number of pointers in array
int main()//w  w  w  .j  av a 2 s .c  om
{                            //array of pointers to char
    char* arrptrs[DAYS] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"  };
    for(int j=0; j<DAYS; j++)    //display every string
       cout << arrptrs[j] << endl;
    return 0;
}

Result


Related Tutorials