A program that makes an integer with the name you specify.
Eg. I run the program, and put "Hello" as the integer name, and it creates an integer called Hello.
Is this possible to do?
A program that makes an integer with the name you specify.
Eg. I run the program, and put "Hello" as the integer name, and it creates an integer called Hello.
Is this possible to do?
variable names have no meaning after the program is compiled, so, no.
Ok, thanks for the quick response.
You dont' necessarily have to use a named variable, you could have a linked list or some sort of table full of name's and their values, ie:
And a linked list of 'cells', for example cell 1 would contain, name = "Hello" value = 2 or whatever.Code:struct cell_t { char name[16]; int value; } cell;
It's dead easy to do in C++, with say
std::map< std::string, int >
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.