⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex1.c

📁 零基础单片机C语言设计全套教程
💻 C
字号:
#include<stddef.h>								//头文件
#include <stdio.h>

struct Mystruct 								//自定义结构
{
	unsigned	long	num;
unsigned	char	type;
	unsigned	int	len;
};

typedef struct Mystruct index;						//声明index

void main(void)									//主函数
{
int	x,y;
x =offsetof(index,num);							//调用offsetof,计算偏移量
y=offsetof(struct Mystruct,len);						//调用offsetof,计算偏移量
printf("x=%d,y=%d\n",x,y);							//输出结果
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -