Originally Posted by
matsp
C does not support sparse arrays. You can of course solve it in the generic way.
--Mats
Thanks for the answer. That need arose when i needed a small (8x8) array with just about 10-12 elements non zero. I tried to think if there was a workaround on this to reduce the constant initializer declaration length.
It tried to use:
Code:
#define K(PREFIX, SUFFIX, N) #define PREFIX##_##SUFFIX (1<<N)
#define PREFIX IOFLAGS
#define FK(SUFFIX,N) K(PREFIX,SUFFIX,N)
FK(READ,1)
FK(WRITE,2)
FK(APPEND,3)
#undef PREFIX
To solve the flags #define's i proposed, but i don't know hot to tell a macro to treat # as a character to be expanded and my macro fails. Any suggestions?