#include<iostream>
using namespace std;
struct student
{
string name;
int age;
int score;
};
void print(const student* s)//地址传递可改变实参
{
//s->age = 100;const不可修改,防止误操作
cout << s->name << " " << s->age << " " << s->score << endl;
}
int main()
{
student s = { "xian",34,55 };
print(&s);
system("pause");
return 0;
}
网友评论