Array of strings - C++ Data Type

C++ examples for Data Type:char array

Description

Array of strings

Demo Code

#include <iostream>
using namespace std;
int main()/*  w  w w  .ja v a 2 s. c  o m*/
{
   const int DAYS = 7;          //number of strings in array
   const int MAX = 10;          //maximum size of each string

   //array of strings
   char star[DAYS][MAX] = { "Sunday", "Monday", "Tuesday","Wednesday", "Thursday", "Friday", "Saturday"  };

   for(int j=0; j<DAYS; j++)    //display every string
      cout << star[j] << endl;

   return 0;
}

Result


Related Tutorials