您的位置 首页 IC

嵌入式offsetof的运用

includestddefh>typedefstruct{unsignedintarray[2];unsignedinta;unsignedcharb;unsignedintc;unsigned

#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);
}

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/bandaoti/317706.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部