Mar 20, 2011 at 8:55pm UTC
Hi,
i want to create a variable, but the name and the type should be given by the user, (IN C)
so example if the user wanted. a integer called worldrecord, i should be able to create it then the variable can be used by the user.
same for character, so the user says i want to create a char with name myname and length 20
so i should be able to create that,
so it would be
char myname[20]
i am not so sure how to do it, i really need help please.
Mar 20, 2011 at 8:59pm UTC
Sounds like you are trying to write a script interpreter. And I think that is a bit above your head right now.
Mar 20, 2011 at 9:12pm UTC
Technically that would probably work... though I REALLY have to ask why you even WANT to do this in the first place?
Mar 20, 2011 at 9:20pm UTC
beacuse what i am trying to do is this:
given a format like;
table subwayLines name:char[30], stops:int, kilometres:float
i have to first create a table name subwaylines (so a sturct)
then in the table i should have three columns or fields, one is call names and is of type char with length 30 and so on
its basically configuration file parsing for a server
also i just realized i can't create a pointer called MyMarks, since i don't know what the user would call it as,
Mar 20, 2011 at 9:31pm UTC
problem is this is in C, and not in C++,
Mar 20, 2011 at 9:32pm UTC
In that case, you will have to write your own map container.