Analogread returns random values.

Is there a reason that my UNO R3 board would return random values on a simple analogread()? This is a simple case of having a routine that only reads A0 (or Ax) and the monitor reads random values in the 300's. No other pins are pushed high or low. There are no leads or any devices attached to the board. I would think that each reading should produce only a zero. Am I missing something?

sample code;

#define a0_input 0

void setup () {
   Serial.begin(9600);
}

void loop (void){
int reading;
reading=analogread(a0_input);
if(reading >0)
{
Serial.pring(reading);
Serial.println();
}
delay(100)
}

Thanks.

Moderator edit: [code] ... [/code] tags added. (Nick Gammon)

I would think that each reading should produce only a zero. Am I missing something?

Yes. Your assumption that a analog input pin should read zero when nothing is wired to it is wrong. Also reading a digital input and assuming it will return a zero with nothing wired to it would also be wrong. In both cases those unwired pins would be stated as having a floating input pin condition and will just return values randomly and unpredictably as they respond to random input electrical noise. The world of electronics is quite different then the world of software. Wire the analog input pin to ground and then you will see a valid 0 value returned.

Lefty