How to write and read the EEPROM?

The EEPROM library only deals with bytes. There are several approaches to handle longer data types. For example: (1) Reduced the longer types to byte values using bit shift operations, (2) Use UNION to access the individual bytes in longer data types, (3) Use the eeprom_write_* and eeprom_read_* functions defined in AVR-Libc. Here is an example of the latter. Note there are also functions for double words (32-bit integers), blocks, and bytes.

#include <avr/eeprom.h>      //http://www.nongnu.org/avr-libc/user-manual/group__avr__eeprom.html
#include <EEPROM.h>          //http://arduino.cc/en/Reference/EEPROM
#include <Streaming.h>       //http://arduiniana.org/libraries/streaming/

int myInt1, myInt2;          //note that a 16-bit int is also referred to as a word
float myFloat1, myFloat2;    //floats require 32 bits

void setup(void)
{
    delay(2000);
    Serial.begin(115200);
    myInt1 = 31416;
    myFloat1 = 3.14159;
    eeprom_write_word( (uint16_t *) 10, myInt1 );    //write a 16-bit int to EEPROM address 10
    eeprom_write_float( (float *) 20, myFloat1 );    //write a float to address 20
    myInt2 = eeprom_read_word( (uint16_t *) 10 );    //read a 16-bit int from address 10
    myFloat2 = eeprom_read_float( (float *) 20 );    //read a float from address 20
    Serial << _DEC(myInt2) << endl;                  //print the values read
    Serial << _FLOAT(myFloat2, 5) << endl;
}

void loop(void)
{
}