Variable int with A0 instead of a number

Hai,

I am starting with my first project.
In an example of analog input I see: "const int sensorPin = A0"
But an integer can only be a number, why is it possible to make it "A0"

Who can explain?

Thanks!

A0 typically has the value 14, on a Uno.

It should really read " "const byte sensorPin = A0;"

You wouldn't worry for an instant about an expression like

int x = 6;
int y = 7;
int theAnswer = x * y;

"A0" is just one of many predefined symbols in Arduino, and is substituted with the numeric value by the compiler.

jremington:
"A0" is just one of many predefined symbols in Arduino, and is substituted with the numeric value by the compiler.

Also note that A0 means analogue pin 0 and the number assigned to it will vary depending on which Arduino board you are using.

You can see what that number is with

Serial.println(A0);

...R