问题见注释处
#include<iostream>
using namespace std;
struct animal{ //定义一个animal的结构体
int weight; // animal的成员变量“体重”
};
void main(){
animal mydog; //我的问题是,如果这里行换成 struct animal mydog;
//也就是多加了一个 struct, 发现也能正常运行。
//那么,加不加 struct 无所谓是吗? 不会对我的程序有影响吧?
mydog.weight = 45;
cout<<mydog.weight<<endl;
}
慕田峪9158850
扬帆大鱼
相关分类