hello! i'm trying to define array of strings, but i havent figured out how..
point is that later i need to printf("%s", strings[x]) all strings out (x is line no.)
hello! i'm trying to define array of strings, but i havent figured out how..
point is that later i need to printf("%s", strings[x]) all strings out (x is line no.)
Code:const int NrOfStrings = 3; const char* const StringArray[NrOfStrings] = { "Hello", "World", "!", };
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
How about this
Code:#include <iostream> #include <string> const int NUM_OF_STRINGS = 4; int main() { const std::string myStrings[NUM_OF_STRINGS] = { "Hello", "How", "Are", "you?" }; for(int i = 0; i < NUM_OF_STRINGS; i++) { std::cout<<myStrings[i]<<" "; } std::cout<<std::endl; std::cin.get(); return 0; }
Woop?