Reputation: 125
So I've been trying to create an object in C that would essentially be two columns of empty char arrays. Its contents would resemble
char * strings[3][2]
{
{"thing1", "value1"}
{"thing2", "value2"}
{"thing3", "value3"}
}
...except the actual char *s would be empty arrays with fixed length, rather than initialized strings, i.e. each string would actually be something like "char string[6]".
I've been searching for some time but I'm coming up dry. Would anyone happen to know the syntax for creating such an object?
Upvotes: 0
Views: 607
Reputation: 476950
Maybe like this:
typedef char sixchars[7];
sixchars strings[3][2] = { { "thing1", "value1" }
, { "thing2", "value2" }
, { "thing3", "value3" }
};
Upvotes: 2