Code for Program that provides an example of passing structure as parameter using call by reference in C++ Programming
#include<iostream.h>
#include<conio.h>
struct box
{
int height;
int weight;
int length;
};
main()
{
clrscr();
void f(struct box &);
struct box b1,b2;
f(b1);
cout<<"Height is :"<<b1.height<<endl;
cout<<"Weight is :"<<b1.weight<<endl;
cout<<"Length is :"<<b1.length<<endl;
f(b2);
cout<<"Height is :"<<b2.height<<endl;
cout<<"Weight is :"<<b2.weight<<endl;
cout<<"Length is :"<<b2.length<<endl;
}
void f(struct box &a1)
{
cin>>a1.height;
cin>>a1.weight;
cin>>a1.length;
}