This is a bit weird, but here goes.
I have many hardcoded "tables" that I'm defining as arrays of std::strings
or const char *
.
So for example:
const char* resp_desc[] = {
"00=Approved",
"01=Declined",
"03=Incorrect User name",
// more values
NULL
};
In some functions these are passed as the table to lookup the description:
const char* lookup(const char* code, const char** table, const char*default="") {
// lookup code is here..
}
my question is, is it possible to call the lookup function without creating the resp_desc array?
The below code was my first attempt, but I get syntax errors around the {}
when trying to use it:
const char* desc = lookup("00", {"00=Approved", "01-Invalid Record", NULL})