见下面的例子:
struct student
{
int score;
string name;
} a;
int main()
{
cin >> a.name >> a.score;
student *b;
b = &a;
cout << b->name << ' ' << b->score << endl;//箭头成员运算符
cout << (*b).name << ' ' << (*b).score << endl;//解引用、点运算符
cout << a.name << ' ' << a.score << endl;//点运算符
return 0;
}
/*
Input
hesor 10086
Output
hesor 10086
hesor 10086
hesor 10086
*/