How do I use an array of character arrays when my setup looks like this:
In classes.h
namespace foomaker
{
class foo
{
const char **mystringarray;
bool ipitythefoo ();
};
}
In foo.cpp
#include classes.h
namespace foomaker
{
bool foo::ipitythefoo()
{
*mystringarray[] = {"Mr. T","Gold Chains","Mohawks"};
return false;
};
}
Compiler is throwing errors:
1>.\foofactory.cpp(5) : error C2059: syntax error : ']'
1>.\foofactory.cpp(5) : error C2143: syntax error : missing ';' before '{'
1>.\foofactory.cpp(5) : error C2143: syntax error : missing ';' before '}'
Or is this even possible?
Unable to use strings, maps, or vectors for this.
The end-result is that this will be for error strings that I need to get by position number. The error strings are specific to this class.
Thanks
What you want to do is not possible. You are trying to re-initialize an array, and that cannot be done. Perhaps, given that your use case is for error strings, you can do something like this:
But then, it’d make more sense for an array of error strings to be
staticto begin with.