Home > Back-end >  C language to an unsigned char type write values greater than 255 actually do
C language to an unsigned char type write values greater than 255 actually do

Time:09-18

For example value is 300, is directly to the address written on 0 x12c or intercept 0 x2c writing?

If it is not directly into 0 x12c will affect other data?

CodePudding user response:

Intercept 0 x2c
Behind, in front of the converted into binary take overflow

CodePudding user response:

The content of the high stage, keep a low byte ~

CodePudding user response:

Written in the form of intercepting 0 x2c, will not affect other data, the extra will discard

CodePudding user response:

Yes, are theoretically will impact, so take more divided by 256, keep low

CodePudding user response:

reference 2 building self-confidence boy reply:
high stage, retain the contents of a byte low ~
interception of c language is the written language rules so? Or related to compiler implementation?

CodePudding user response:

refer to fifth floor native yoga response:
Quote: refer to the second floor confident boy reply:

The content of the high stage, keep a low byte ~
interception write c language is so? Or related to compiler implementation?

In the memory is so of the deposit, such as a 4 bytes int data, high high byte, low low byte (small end system), so 0 x12c is the size of the 2 bytes, so zero x2c on low byte, or put in for you to define variable, 0 x01 is on the high byte, but when you take variable, is less than 0 x01, can only take x2c 0, because it is unsigned char
  • Related