其他分享
首页 > 其他分享> > 17.3结构体的嵌套

17.3结构体的嵌套

作者:互联网

#include<stdio.h>

/*
* 结构体嵌套:结构体允许再内部定义另外一个结构体
* 结构体数组:数组的每个成员都是结构体
*/

//子弹结构体 坐标 速度 harm
struct
{
	int x;
	int y;
};
struct Bullet
{
	struct
	{
		int x;
		int y;
	}pos;
	//struct Point pos;	//嵌套了
	int dx;				//vx xSpeed
	int dy;				//vy ySpeed
	int harm;			//伤害
};

int main()
{
	struct Bullet blet;
	blet.pos.x;
	blet.pos.y;
	blet.dx;


	return 0;
}

 

标签:blet,struct,嵌套,int,pos,17.3,结构
来源: https://blog.csdn.net/shi_xiaobin/article/details/122867262