Gentlemen, I am a novice C++ programmer, When I was trying to learn how to use EEPROM with Arduino, I came across this statement

i2c_eeprom_write_page(0x57, 0, (byte *)somedata, sizeof(somedata));

where I need to know what does (byte*) somedata mean?, please let me know if someone know the answer



  • external EEPROM?
    – Juraj
    Sep 7 '19 at 16:43

It means "Interpret this pointer as a pointer to byte data". It's called "Casting" and allows you to fool the compiler into thinking that one type of data is another.

For example, your function expects a byte * (a pointer to byte data), and if you have char * as your variable you can change it on the fly to byte * by casting it like that.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.