by Dinesh Thakur Category: Functions

 

#include <iostream.h>

#include <conio.h>
struct bio
{
     char name[10];
     int age;
     int salary;
}b1;
     bio disp(bio b2)
         {
             cout<<"\nName : "<<b2.name;
             cout<<"\nAge : "<<b2.age;
             cout<<"\nSalary : "<<b2.salary<<"\n";
             b2.salary=b2.salary * 5;
             return b2;
          }
   void main()
{
           bio disp(bio);
           bio b3;
           clrscr();
           cout<<"Enter Name :";
           cin>>b1.name;
           cout<<"Enter Age :";
           cin>>b1.age;
           cout<<"Enter Salary :";
           cin>>b1.salary;
           b3=disp(b1);
           cout<<"\nName1 :"<<b3.name;
           cout<<"\nAge1 :"<<b3.age;
           cout<<"\nSalaryl :"<<b3.salary;
           getch();
}

Illustrates Passing Structure To A Function



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles