Variable with char[] name

后端 未结 3 418
星月不相逢
星月不相逢 2021-01-24 07:15

How can I make variable in C with name specified in char table?

something like:

char name[];
gets(name[]);
int name[] = 0;

I hope you k

3条回答
  •  野性不改
    2021-01-24 07:45

    This might be what you want. C does have a lookup table in the form of the preprocessor table where you define keywords and the text that goes with them, which are added at compilation time. So you could pass a name or whatever you want as an arg to the program during compilation and if you code it right, it will affix that name during the preprocessor portion of the compilation phase to your variable. Preprocesor phase is what looks at your #include at the top, as well as things such as #ifndef...#def, #if...#endif and so forth, C preprocessor example

提交回复
热议问题