Atmel 24C256 showing up at wrong I2C address

You pass the data into the i2c_eeprom_write_byte function as a byte. You store the byte in an int. Then, you cast the int to a byte to actually write it. Why?

You are converting the address to two bytes, then casting the bytes as ints to specify the two byte address. Why?