C++ char array of pointers to strings

Description

C++ char array of pointers to strings

#include <iostream>
using namespace std;
const int DAYS = 7;             //number of pointers in array
int main()// w  ww  .  j  ava2 s  .  c  o m
{                            //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;
}



PreviousNext

Related