   Have problem with class initalization
  Hello. I am writing a small text RPG in C++ using Dev-C++. I have a room class:class Room{public: //for testing, later private    string description;    string room_id;    Room(); //empty for now    //etc...};I declare an array of Room objects:Room world[10];I initialize my world:void initializegame(){world[1].description="Blah, Blah, Blah";world[2].description="Blah, Blah, Blah";//etc...}This compiles fine. But when I go to run this the initalizations crash the program. Does anyone have any idea why this is happing? Have I given enough information?Thanks for your help.   
Quote:void initializegame(){world[1].description="Blah, Blah, Blah";world[2].description="Blah, Blah, Blah";//etc...}I guess you are using world[1] to world[10]. C++ arrays are zero-based, meaning that an array of 10 elements will go from index 0 to 9. Thus world[10] is trying to access an hypothetical 11th element, which is beyond the end of the array. Writing there is a Bad Idea™.   ;  Thanks for the reply. I understand that about arrays, but even if I only initialize the first element, world[0].description, the program is still crashing. ;  In that case you'll need to show a more complete code example that demonstrates your problem. As it is, the code you've shown seems fine.   