This is an extract of the official ATMEGA328p data sheet page 261:
As the documentation say
Vin * 1024
ADC = ----------
Vref
What I don't understand is an analog pin can provide us 10bits. That's mean a value between 0x0 and 0x3ff (1023)
So I don't understand why the documentation say Vin * 1024
and not 1023. Because for me 0v = 0 and 5v = 1023?
Yeah this is a common mistake. One thinks 10 bits = 2^10 = 1024 and so there will be 1024 steps, right? Nope, 10 bit ADCs only give output up to 1023 (3FFh), because that is the largest number you can fit into 10 bits.
So if you do arithmetic on 1024 instead of 1023, you introduce a very slight inaccuracy in the calculation. I've done this bug myself and it sat in production code for over 10 years without anyone noticing, and when I fixed the bug nobody noticed a difference either :) But naturally we should always strive for program correctness.