using a variable to store an analog pin number

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.