Page 1 of 1

constans array of string?

Posted: Thu Jun 08, 2006 12:25 am
by fixit
How to make a array of string whith is constans ?
How to make it with #DEFINE ?

Posted: Thu Jun 08, 2006 8:15 am
by misof

Code: Select all

#include <iostream>
#include <string>
using namespace std;

string myStrings[] = {"hello", "world", "funny", "isn't", "it"};

int main() {
  cout << myStrings[1] << endl; // prints "world"
}
I can't imagine a reason why one should use #define here.