嵌入式 > 嵌入式开发 > 详情

嵌入式offsetof的使用

发布时间:2024-05-23 发布时间:
|
#include

typedef struct
{
unsigned int array[2];
unsigned int a;
unsigned char b;
unsigned int c;
unsigned int d;
float f;
}foo;

void main(void)
{
int addr=0;
addr = offsetof(foo,c);
P1 =addr;
addr = offsetof(foo,f);
P1 =addr;
addr = offsetof(foo,a);
P1 =addr;
addr = offsetof(foo,d);
P1 =addr;
addr = offsetof(foo,b);
P1 =addr;
while(1);
}



『本文转载自网络,版权归原作者所有,如有侵权请联系删除』

热门文章 更多
详解stm32能跑什么系统