①值传递
②地址传递
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
struct stu
{
int age;
string name;
};
void printStu(stu a)
{
cout << a.age << ' ' << a.name << endl;
}
void printstu(stu* p)
{
cout << p->age << ' ' << p->name << endl;
}
int main()
{
stu x = { 22,"adele" };
printStu(x);
printstu(&x);
}