Can't save data in Arduino EEPROM

PaulS:
Look at the EEPROM::write() function. Notice, in particular, what the type of the 2nd argument is. Then, compare that to the types of the arguments that you provide.

If you were to call the function with the correct type of argument, you would get correct results.

If that is the root of the problem, then part of the blame might be the example sketch used in the Arduino reference section for EEPROM:

Example
#include <EEPROM.h>

void setup()
{
  for (int i = 0; i < 512; i++)
    EEPROM.write(i, i);
}

void loop()
{
}

And I ran the OP's sketch and it seemed to work fine writing to eeprom, and later after commenting out the writting to eeprom, still held and printed valid data from the eeprom.

Lefty