K
Kalle Anka
I'd like to have a couple of arrays of strings where the first strings
are the same in all arrays.
I tried this:
#define COMMON_STRINGS "alfa", "bravo", "charlie"
char *firstStrArr[] = {COMMON_STRINGS, "delta", "echo", "foxtrot"};
char *secondStrArr[] = {COMMON_STRINGS, "golf", "hotel", "india"};
char *thirdStrArr[] = {COMMON_STRINGS, "juliett", "kilo", "london"};
It works fine when I compile it with gcc, but I always feel little bit
shaky when it comes to strings and preprocessing, so I wonder if this is
correct and portable?
Thanks
/Krister
are the same in all arrays.
I tried this:
#define COMMON_STRINGS "alfa", "bravo", "charlie"
char *firstStrArr[] = {COMMON_STRINGS, "delta", "echo", "foxtrot"};
char *secondStrArr[] = {COMMON_STRINGS, "golf", "hotel", "india"};
char *thirdStrArr[] = {COMMON_STRINGS, "juliett", "kilo", "london"};
It works fine when I compile it with gcc, but I always feel little bit
shaky when it comes to strings and preprocessing, so I wonder if this is
correct and portable?
Thanks
/Krister