using a variable to store an analog pin number

PaulS:
A0 is NOT a variable name. It is a #define'd name that has an associated value. The value is replaced everywhere in the code where the name A0 is used.

See reply #1 which quotes the actual Arduino (hardware/avr/variants/standard) core code:

#define PIN_A0   (14)
static const uint8_t A0 = PIN_A0;
1 Like