You are here:

C++/Initializing static const arr

Advertisement


Question
Hi Vijayan,

        Can you tell the possible ways of initializing static const string arr[7] with weekday names. And also suggest me the best way.

Thanks in advance
Bhupal.

Answer
   enum { NDAYS = 7 };

   static const std::string arr[ NDAYS ] =
   {
         "Monday",
         "Tuesday",
         "Wednesday",
         "Thursday",
         "Friday",
         "Saturday",
         "Sunday"
   } ;

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


vijayan

Expertise

my primary areas of interest are generic and template metaprogramming, STL, algorithms, design patterns and c++11. i would not answer questions about gui and web programming.

Experience

about 15 years or so

Education/Credentials
post graduate engineer

©2016 About.com. All rights reserved.