Call diffrent Variables based on a nother Variable

Hi
Hw can i Call diffrent Consts based on a nother Variable
For example

#define pin3 3
#define pin2 2
#define pin1 1 
foo = 3
digitalWrite(pin"foo", HIGH);

the "foo" should then be replaced with a 3. I know a switch but its too long for my application. i have ~30 pins.so it would be too long
Thanks

No you can’t c++ is compiled and all names go away, you can’t find them at run time

Use an array

Actually it for its for calling another array for another array index
but yeah thx anyways

duplicate post
https://forum.arduino.cc/index.php?topic=686013.0

rusus:
Actually it for its for calling another array for another array index
but yeah thx anyways

You mean a two-dimensional array? We have those!

I believe this current Thread from another Forum member deals with the exact same question

...R