Logo 
Search:

C++ Programming Articles

Submit Article
Home » Articles » C++ Programming » Homework HelpRSS Feeds

Program that provides an example of passing structure as parameter using call by reference

Posted By: Adele Fischer     Category: C++ Programming     Views: 3885

Write a program that provides an example of passing structure as parameter using call by reference.

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;
}
  
Share: 



Adele Fischer
Adele Fischer author of Program that provides an example of passing structure as parameter using call by reference is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!