Variable with char[] name

后端 未结 3 388
星月不相逢
星月不相逢 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:42

    You can't. At least not with the vanilla C language features. But remember, C has pointers which sometimes can do something similar.

    If pointers aren't what you need, you will have to implement a hash map. Higher level programming languages have them built in, but C doesn't.

    You could find a library, but if you are doing this for learning, I would recomend implimenting it yourself.

提交回复
热议问题