Data Type Truncation

后端 未结 2 1612
小蘑菇
小蘑菇 2021-01-27 11:42

I have a basic C question.

Suppose I\'ve declared and initialized a standard 16 bit unsigned integer

uint16_t var1 = 0x1234;

and then s

2条回答
  •  Happy的楠姐
    2021-01-27 12:10

    Yes. The compiler would internally interpret this as

    var2 = (uint8_t)var1;
    

    which would result in var2 having the value 0x34.

提交回复
热议问题