相关文章推荐
酷酷的酱牛肉  ·  ARM CMSIS ...·  3 周前    · 
逆袭的登山鞋  ·  Roc 曲线下面积 - 知乎·  5 月前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Incompatible pointer to integer conversion initializing 'UInt8' (aka 'unsigned char') with an expression of type 'UInt8 [15]

What type do I need to cast to in order to compile? I have tried adding [15] subscript in different places and could not solve it. Also an explanation of what [15] means in UInt8 c[15];

Thanks

I guess packet is declared as myStruct packet; . If so, packet->c is an array of UInt8 , you can store up to 15 items in this member. That's why you cannot assign it's value to a single UInt8 . Replace UInt8 c = packet->c; with UInt8* c = packet->c; . To get the first c 's item use the following code: UInt8 firstC = c[0]; .

Thanks for the answer.How could I assign value to struct member c ? When I try myStruct.c = value; I get the following error Array type 'UInt8 [15]' is not assignable . But I cn assign values to single UInt8 's. AnonProgrammer Aug 26, 2019 at 14:03

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .