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++09. i would not answer questions about gui and web programming.

Experience

over 15 years

Education/Credentials
post graduate engineer

©2012 About.com, a part of The New York Times Company. All rights reserved.