S
Suddn
Here is a real beginner type question:
I wish to use constants in place of numbers when dimensioning string
arrays. However I get an error when doing so. (Linux/KDevelop)
The following gives me the error "error: syntax error before `;' token"
and refers to the 'string s[MAX_ROW]; line.
#include <string>
#define MAX_ROW 256;
using namespace std;
string s[MAX_ROW];
int main(int argc, char *argv[])
{
return EXIT_SUCCESS;
}
However the following compiles cleanly:
#include <string>
using namespace std;
string s[256];
int main(int argc, char *argv[])
{
return EXIT_SUCCESS;
}
How can I use constants in dimensioning string arrays?
Thanks.
I wish to use constants in place of numbers when dimensioning string
arrays. However I get an error when doing so. (Linux/KDevelop)
The following gives me the error "error: syntax error before `;' token"
and refers to the 'string s[MAX_ROW]; line.
#include <string>
#define MAX_ROW 256;
using namespace std;
string s[MAX_ROW];
int main(int argc, char *argv[])
{
return EXIT_SUCCESS;
}
However the following compiles cleanly:
#include <string>
using namespace std;
string s[256];
int main(int argc, char *argv[])
{
return EXIT_SUCCESS;
}
How can I use constants in dimensioning string arrays?
Thanks.