📌  相关文章
📜  ":" in struc - C 编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:43.661000             🧑  作者: Mango

代码示例1
/* It's used to save some memery in a struct

It basically tells the compiler that 
"hey, this variable only needs to be x bits wide,
so pack the rest of the fields in accordingly, OK?" */

// Exemple
struct remain {
  int mod3 : 2; // int usualy takes 4 bits in memory but here it will be only 2
  int mod4 : 2;
  int mod5 : 3; // and here 3
};