Is it possible to have a variable inside the name of another variable ?
For example we have 12 variables (a1,a2,a3,...,a12) and we want to make if statements with these variables like:
If (a1>....){something}
.
.
.
if (a12>....){something}
Could we do something like:
for (i=1; i<13; i++){
If (a_i>....){something}
}
I can well understand that a2, ai and a_i are three completely different variables but I am asking whether there is a way of doing this in order to avoid repeatitive programming.
Thank you in advance,
Alex
AWOL thank you for your reply !
I know about arrays and I am aware how the work so that is what I am going to do, but apart from an array this cannot be done the way I said, can it ?
Thanx again.
No, tampering with the name after compilation is not possible and the macro pre processor doesn't have a loop construct, so an array and loop is the right way to go.
but apart from an array this cannot be done the way I said, can it ?
No. Names are for your use. The compiler discards them all, replacing them with addresses. If you store a name that goes away, the stored name will not be useful.