preprocessor directive - Token pasting in c using a variable that increments -
i have set of arrays :msg1[]
msg2[]
.... msgn[]
. , need use values in while
loop. msgi[]
. when define #define msg(a) msg##a
, put in loop , increment i
, expands msgi
?
you can't way. instead create new array, contains pointers actual arrays:
int array1[...]; int array2[...]; int *all_arrays[] = { array1, array2 };