0

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

Regards,

Mr.B

1
  • external EEPROM? Commented Sep 7, 2019 at 16:43

1 Answer 1

2

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.

3
  • Thanks Mr.Majenko Can you please refer me some material or website for me to learn more about this topic, It would be helpful . Thanks for the reply Commented Sep 7, 2019 at 16:25
  • tutorialspoint.com/cprogramming/c_type_casting.htm Commented Sep 7, 2019 at 16:39
  • Thanks Mr.Majenko Commented Sep 7, 2019 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.