I’m a ruby developer and its been long time since I’ve coded in C. I want to use a datatype in C which behaves like a symbol.
Is this possible?
-
Program asks user for name
-
User replies – "foobar"
-
Program declares an integer with the same name i.e.
int foobar;
Unlike in interpreted languages, C does not have a dictionary of variable names at runtime. There exist no variable names at runtime at all. Hence unfortunately it is impossible to do what you want in C.