Birds *Bird = (Birds*)malloc(sizeof(Birds)); struct Birds { int x,y; int condition; }; Birds *Bird = (Birds*)malloc(sizeof(Birds)); struct Bg { int x,y; int l_blank; int reward[9]; Bg *pri; Bg *next; }; Bg *Bg1 = new Bg[sizeof(Bg)]; void Position(int

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/29 18:40:57
Birds*Bird=(Birds*)malloc(sizeof(Birds));structBirds{intx,y;intcondition;};Birds*Bird=(Birds*)malloc

Birds *Bird = (Birds*)malloc(sizeof(Birds)); struct Birds { int x,y; int condition; }; Birds *Bird = (Birds*)malloc(sizeof(Birds)); struct Bg { int x,y; int l_blank; int reward[9]; Bg *pri; Bg *next; }; Bg *Bg1 = new Bg[sizeof(Bg)]; void Position(int
Birds *Bird = (Birds*)malloc(sizeof(Birds));
struct Birds
{
int x,y;
int condition;
};
Birds *Bird = (Birds*)malloc(sizeof(Birds));
struct Bg
{
int x,y;
int l_blank;
int reward[9];
Bg *pri;
Bg *next;
};
Bg *Bg1 = new Bg[sizeof(Bg)];
void Position(int x,int y)
{
COORD pos = { x - 1,y - 1 };
HANDLE Out = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(Out,pos);
}
请问可以给我讲解一下这段代码的意思吗?

Birds *Bird = (Birds*)malloc(sizeof(Birds)); struct Birds { int x,y; int condition; }; Birds *Bird = (Birds*)malloc(sizeof(Birds)); struct Bg { int x,y; int l_blank; int reward[9]; Bg *pri; Bg *next; }; Bg *Bg1 = new Bg[sizeof(Bg)]; void Position(int
Birds *Bird = (Birds*)malloc(sizeof(Birds));
在程序进程的动态堆里分配大小为sizeof(Birds)字节的空间,并创建指针指向这一空间,把指针的格式从void*强制转换为(Birds*).