用结构体变量的引用做函数参数
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;
}
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;
}
相关文章推荐
- 作为函数参数的临时变量的引用必须是const的
- 结构体变量、结构指针变量、结构数组作为函数的参数应用实例分析
- 结构体变量及成员作为函数参数
- php引用(&)变量引用,函数引用,对象引用和参数引用用法详解
- C语言_结构体变量指针做函数参数的使用案例
- 018--python 函数参数、变量、前向引用、递归
- 结构体变量、结构指针变量、结构数组作为函数的参数应用实例分析
- [c++学习笔记]反汇编角度看变量名和引用作为函数参数
- 结构体变量作为函数的参数和返回值 .
- php 函数参数引用和普通变量 传参区别
- (struct)结构体变量作为函数参数调用的方法小结
- C语言再学习之:结构体引用为函数参数
- 3、定义一个结构体变量(包含年月日),计算该日在本年中为第几天?要求写一个days函数。参数是此结构体类型的变量,返回值是整数。
- C++ primer(八)--内联函数 引用变量 引用传递函数参数 函数重载/模板/模板具体化
- 指针、引用、一般变量(int 等)作为函数参数的结果对比
- C语言基础知识之(十二):结构体作为函数的参数(结构体变量、结构体数组)
- 简化版定义一个结构体变量(包含年月日),计算该日在本年中为第几天?要求写一个days函数。参数是此结构体类型的变量,返回值是整数
- 指向结构体变量的指针作函数参数
- 定义一个结构体变量(包含年月日),计算该日在本年中为第几天?要求写一个days函数.参数是此结构体类型的变量,返回值是整数
- php引用(&)变量引用,函数引用,对象引用和参数引用用法详解