Please explain this code: *((char*)

Trying to understand how to store 5 long numbers in the EEPROM, I'm looking at this page:

http://arduino.cc/playground/Code/EEPROMLoadAndSaveSettings

I think I follow it all until I get to this line in Void LoadConfig()

*((char*)&storage + t) = EEPROM.read(CONFIG_START + t);

Is storage an array? What's with the beginning * --can't find anything on it in the code reference.

"Treat the address of the long (&storage) as a pointer to a set of bytes instead ((char*)&storage) so that it can be copied from EEPROM (which is byte-wide) Point to the Tth byte ((char )&storage +t) and actually put the byte in the ram references by the pointer ((char*)&storage +t)"

The leading * dereferences the pointer to the array + offset. This allows you to access the value at that address.

Cheers,

Thanks.
This cleared it up, after you used the word dereference. Never heard of any of this, but I kinda understand, now.
http://www.cplusplus.com/doc/tutorial/pointers/

cleared it up, after you used the word dereference.

Huh. And here I carefully avoiding using exactly that word; it hadn't occurred to me that it would be a good search term. I'll have to remember to consider that...

westfw:

cleared it up, after you used the word dereference.

Huh. And here I carefully avoiding using exactly that word; it hadn't occurred to me that it would be a good search term. I'll have to remember to consider that...

Me like use big words... :wink:

G.