1樓:海天盛
任意選擇,u8是unsigned char,u16是unsigned short,u32是unsigned long。
u8、u16和u32都是c語言中的資料型別,分別表示8位、16位和32位長度的資料型別。一個位元組是8位,所以u8是1位元組,u16是2位元組,u32是4位元組。
可以在stm32庫標頭檔案中找到資料型別的宣告。
在中:typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;
在 中:typedef uint32_t u32;
typedef uint16_t u16;
?x-bce-process=image%2fresize%2cm_lfit%2cw_600%2ch_800%2climit_1%2fquality%2cq_85%2fformat%2cf_auto" esrc="https:
com/dcc451da81cb39dbff1cd32ac0160924aa1830e9"/>
2樓:網友
u8 最大255 u16最大65535 就這個意思u8 a=255 a+1=0 u16 b=255 b+1=256 。
是根據變數可能的最大值 與最小值 確定 變數的定義。
當然 你都定義成u32肯定不容易爆 但是這樣很費ram。