Array of Strings
I know if i did
1 2 3
|
int code[20];
code[0] = 12
cout<<code[0];
|
I would get "12" printed. But is there a way to get a string into an array?
for instance...:
1 2 3
|
int code[20];
code[0] = "Zero";
cout<<code[0];
|
Now this doesnt work, but is there a way to get a string into an array? TYhanks for help guys. :)
Yeah:
1 2 3
|
char code[] = "Zero";
for (int i=0;i<5;i++)
cout << code[i];
|
Where 5 is the dimension of the array. You could use a overloaded operator, but that's still too far I guess.
Topic archived. No new replies allowed.