1

A char in C is not always 8 bits length as it is platform dependent. Its length using bits is given by CHAR_BITS value.

Howewer, definition for standard network protocol headers is done using a Byte as its length is 8 bits. For instance, ethertype field in 802.3 frame header has 2 bytes, each one has 8 bits.

I wonder, when char type in machine is 16 bits, and any type should be addressable using this char length, how is the memory content filled with a frame when it arrives to the machine?. Which primitive C type should be used to represent a ethertype in frame, in machines where char type length value is larger than 8 bits?

MABC
  • 576
  • 2
  • 11
  • 29

1 Answers1

0

If we look at how the PIC stores uint8_t strings in its flash, which is word-oriented and the word-size depends on the PIC (it is neither 8 nor 16 bits in some PICs), the upper bits are simply zeroed.