搞笑的魔兽牧师名字:结构体的赋值及初始化问题

来源:百度文库 编辑:高考问答 时间:2024/04/28 08:31:46
typedef struct tagdbROBOTPOSTURE
{
double x;
double y;
double theta
}dbROBOTPOSTURE, RobotInford;
RobotInford *nextrobot;
nextrobot->x = 14;
nextrobot->y = 20;
nextrobot->theta = 35;
这一段代码老是提示“warning C4700: local variable 'nextrobot' used without having been initialized” 这是什么问题呀;

nextrobot 还没指向呢,当然能付值.
typedef struct tagdbROBOTPOSTURE
{
double x;
double y;
double theta
}dbROBOTPOSTURE, RobotInford;
RobotInford *nextrobot,robot;
nextrobot=&robot;
nextrobot->x = 14;
nextrobot->y = 20;
nextrobot->theta = 35;
这样就可以

警告呀,你的变量未赋值先使用了。

你还没有给 nextrobot 赋值,就先使用它了。