If a string\'s length is determined at compile-time, how can I properly initialize it?
#include int length = 3; string word[length]; //invalid
You can initialize your string like this:
string word = "abc"
or
string word(length,' '); word[0] = 'a'; word[1] = 'b'; word[2] = 'c';