您的位置:首页 > 其它

用结构体变量的引用做函数参数

2013-03-30 11:22 405 查看
#include<iostream>

using namespace std;

struct student

{

int num;

char name[20];

float score[3];

}stu={12345,"li",66,67,68};

int main()

{

void print(student &);

print(stu);

return 0;

}

void print(student &stu) //函数定义,形参为结构体student变量的引用

{

cout<<stu.num<<" "<<stu.name<<endl;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐