-2

For my iPhone app in objective-c is it possible, and if so how can I make a variable inside a variable?

For example, I have one named Var1 and then I can combine it with Var2. Lets say Var2 is a number, so it displays Var1 like Var11, the second one being Var2. Make sense? Anyway if Im not making sense, could you let me know how a variable in a variable can be done, and used? Thanks.

Josh Kahane
  • 16,765
  • 45
  • 140
  • 253
  • I'm afraid you're not making much sense. Do you want `Var1` to "contain" just `Var2`? Or is `Var1` meant to "contain" a few variables? Or have I got the completely wrong enough of the stick? – Stephen Sep 11 '10 at 12:10
  • Do you mean anything like what's asked here? (Objective C Equivalent of PHP's “Variable Variables”) http://stackoverflow.com/questions/2283374/objective-c-equivalent-of-phps-variable-variables – BoltClock Sep 11 '10 at 12:15
  • Sounds like you could either be asking about arrays, where Var2 is an array index, or asking about reference by name using mutable names, where "Var11" is a string representation of a variable name produced by string concatenation of "Var1" + "1". Which? – hotpaw2 Sep 11 '10 at 13:10
  • 1
    Can you give an example of what you are trying to do from another programming language? I think we are having trouble knowing exactly what you mean and maybe this would help. :) – BobbyShaftoe Sep 11 '10 at 17:46
  • Apologies for the late reply. BoltClock has the right idea, thats what i mean to achieve. Second comment. – Josh Kahane Sep 12 '10 at 08:12

1 Answers1

1

Are you talking about arrays? Use Arrays.

Somnath Muluk
  • 55,015
  • 38
  • 216
  • 226
Lie Ryan
  • 62,238
  • 13
  • 100
  • 144