Write a program to illustrate the comparison of structure variables.

Struct class
{
   Int number;
   Char name[20];
   Float marks;
};
Main()
{
Int x;
Struct class std1={111,”rao”72.50};
Struct class std2={222,”reddy”,56.00};
Struct class std3;
Std3=std2;
X=((std3.number==std2.number)&&(std3.marks==std2.marks)) ?1:0;
If(x==1)
{
Printf(“\nstd2 and std3 are same \n\n”);
Printf(“%d %s %f \n”,std3.number,std3.name,std3.marks);
}
Else
Printf(“\nstd2 and std3 are different \n\n”);

}          

0 Comment "Write a program to illustrate the comparison of structure variables."

Post a Comment