日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

48.结构体位域获取内存模型

發布時間:2025/7/14 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 48.结构体位域获取内存模型 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
數據在linux和windows上是低字節在地位,高字節在高位,以此方法可以驗證
運行結果:
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 struct weiyu 5 { 6 unsigned char w0 : 1; 7 unsigned char w1 : 1; 8 unsigned char w2 : 1; 9 unsigned char w3 : 1; 10 unsigned char w4 : 1; 11 unsigned char w5 : 1; 12 unsigned char w6 : 1; 13 unsigned char w7 : 1; 14 }; 15 16 void main() 17 { 18 int num = -1; 19 int count = 4;//讀幾次 20 21 struct weiyu *wei; 22 23 wei = &num; 24 25 for (int i = 0; i < count; i++) 26 { 27 printf("%d%d%d%d%d%d%d%d ", (wei + i)->w0, (wei + i)->w1, (wei + i)->w2, (wei + i)->w3, 28 (wei + i)->w4, (wei + i)->w5, (wei + i)->w6, (wei + i)->w7); 29 } 30 system("pause"); 31 }

?

轉載于:https://www.cnblogs.com/xiaochi/p/8370892.html

總結

以上是生活随笔為你收集整理的48.结构体位域获取内存模型的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。