One way: to determine that char* []
is global and use its indexes to access it:
char stringLiterals [] = { "0101010", "10010010", "111", "010100100", ... };
Usage : Instead
char *p = stringLiteral[3];
using
unsigned int idx = 3;
Justification . If you compress this string into bits for serialization purposes, than this is normal. But otherwise, I do not see any case of compaction. In my solution above, does not use extra memory . You already have an array of string literals; I just ask you to declare it globally and use its index.
Also, if the string size is> 32 bytes, you cannot save it in a single 32-bit int
.
source share