Possible Duplicate:
Syntax help - Variable as object name
I have a very basic beginner's question in Objective C:
I'd like to declare a variable that is named after the content/value/literal of another variable. How can I do that?
I.e.
NSString *s = [NSString stringWithFormat:@"variableName"];
// now create a second variable that is named after the literal in s
int *s = 42; // This is what doesn't work. The integer-type variable should be named variableName
Does anyone know how to do this?
Thanks for the answers so far. The reason why I am asking this questions is the following:
I have an array containing values I load from an xml file structured as follows:
<string>name</string><integer>23</integer><real>3.232</real><real>4.556</real> ... (44 times another real number)<string>nextName</string>...(and so on).
The file contains the names for MKPolygons, the number of points for each polygon and the latitude and logitude values for each point of the polygon. I managed to load the file and have its content in an array. Now I want to create MKPolygons from this array which are named as the strings in the array.