Yeah 'no' is the answer. Since your 'a' variable is an int, why not just build an array of pointers to struct pro and index it that way?
Yeah 'no' is the answer. Since your 'a' variable is an int, why not just build an array of pointers to struct pro and index it that way?
A better question might be: why do you think you need to do that?
You could probably simulate it with a map-like structure.
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
"the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010
It sounds like you want an an associative array. Many high level languages have this feature built in. In python you would use a dictionary.
I implemented something like this once in C, but its quite tedious. The way I did it was to have a linked list of structs holding a string for the variable name, an integer enumerating the datatype, and a void pointer holding the data. To look up a variable i'd then run through the list using strcmp to find if it existed. Perhaps its not the most efficient way of doing it, but it worked. That said theres probably libraries around that can do this stuff better.