-
Strings
This is one of those times where i wish i was still programming in VB. I've included the string.h lib, now how do I declare a variable as a string? Actually i want to declare an array of strings, so if you could give me the syntax for that i would much appreciate it.
thanks
jmiller
-
string.h is deprecated (sp?). Just use #include <string>
Code:
#include <string>
using namespace std;
int main()
{
string s[20]; //array of 20 strings (indexes are 0 - 19)
//do something with the strings
return 0;
}
:)
-
And if you need a dynamic array take a look at vectors. Fairly painless to use.