#include<iostream>
using namespace std;
struct Student {
string name;
int age;
int score;
};
void printStudent(const struct Student *p)//传递过来的是地址,防止数据被修改,用const修饰
{ //struct Student *stu是个结构体指针,占4个字节,节省内存
cout << p->name << endl << p->age << endl << p->score << endl;
}
int main()
{
struct Student stu = { "xiaowang",20,95 };
printStudent(&stu);
system("pause");
return 0;
}