I'm porting a game from the Sega Genesis to the Sega Saturn, and limited to C. I'm also following how the game is coded in Motorola 68000 assembly code as closely as possible, which requires many, many arrays of identical structures. I'm talking upwards of 300 or more. For the sake of organization and readability, it would be easier to name them with numbers instead of a string of characters
For example, I would prefer:
int 000[4] = {1, 2, 3, 4};
int 001[4] = {1, 2, 3, 4};
As opposed to:
int zerozerozero[4] = {1, 2, 3, 4};
int zerozeroone[4] = {1, 2, 3, 4};
But my compiler won't compile unless the array name starts with a character. Is there a way to do this? I suppose I could just throw an a
at the front of the arrays, but I'd like to avoid that if possible.
It's not possible to do this, no.
However, you can begin the variable name with any valid character (such as a letter or underscore) and then make the rest numbers.
For example, instead of
int 001[4]
you could doint _001[4]
.For people just reading my answer - shoutout to unwind who answered below on how this is not great design for human reading or usability. See and upvote his answer too for more details.