结构体和指针
1 #include<iostream> 2 #include<string> 3 4 using namespace std; 5 //结构体 6 struct Student 7 { 8 string name; 9 int age; 10 }; 11 //函数 打印 12 void Printfstu(struct Student *st) 13 { 14 cout<<st->name <<"__"<<st->age<<endl; 15 } 16 17 int main() 18 { 19 Student stu = {"zhangsan",13}; 20 Printfstu(&stu); 21 system("pause"); 22 return 0; 23 }