C 语言错误修复:Robot 类型未知和成员访问错误
The code you provided has multiple errors.
The first error is that the type Robot is unknown. To fix this, you need to define the struct Robot before using it:
struct Robot {
int blood;
int x;
int y;
};
The second error is that you are trying to access the blood member of robot without using the dot operator on a structure or union. To fix this, you need to use the dot operator:
robot.blood = 100;
The third error is similar, you are trying to access the x member of robot without using the dot operator:
robot.x = 0;
After making these changes, your code should compile without errors.
原文地址: https://www.cveoy.top/t/topic/pxd6 著作权归作者所有。请勿转载和采集!