I can't seem to wrap my head in the code below.

unit8_t BYTE;

Does this create a data type the size of 8 bytes? But don't I need 512 bytes for the buffer?

BYTE buffer[512];

Does this create an array with 8 bytes for each element in the array?


No, a uint8_t is not 8 bytes, it's 8 BITS. 8 bits = 1 byte.

A uint8_t is an unsigned 1 byte data type, or a BYTE, once you define a BYTE in your code as a data type. A char behaves like a SIGNED 1-byte data type, thus the need for the uint8_t. It's the easiest way to handle data that you just want to process in a raw form.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

  • So buffer's size is only 8 bits or 1 byte because I declared BYTE buffer[512]; If that's true, how can an array size of 512 fit inside 8 bits? – sisball8 Apr 11 '16 at 14:02
  • It can't. But you're not doing that. You're declaring a buffer of 512 bytes ( or 4096 bits). The size of each element in the array of 512 elements is 1 byte. – Cliff B Apr 11 '16 at 15:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .