Code:
if (z == 18) {
int temp[] = {-6, -3, 0, 4, 8, 6, 2, -4 };
/* of course you can use
#define INIT_ARRAY { -6, -3,0,blah} int temp[] = INIT_ARRAY;
*/
// copy
memcpy(f[1],temp,sizeof(temp));
} else {
int temp[] = {-7, -3, 0, 5, 8, 6, 2, -8 };
// similar
}
Or use variadic macro. Example (Not suppose to be perfect
Code:
#define INIT_ARRAY(array,type,...) \
do { \
memcpy(array, ( type [ sizeof(array)/sizeof(array[0]) ]) { __VA_ARGS__ }, sizeof(array) ); \
} while(0)
INIT_ARRAY(f[1],int, 3,4,5 ); // eg usage
} while(0)