Find the output for the following C program#include<stdio.h>void main(void){struct s{int x;float y;}s1={25,45.00};union u{int x;float y;} u1;u1=(union u)s1;printf("%d and %f",u1.x,u1.y);}

Showing Answers 1 - 1 of 1 Answers

Tejram

  • Feb 11th, 2006
 

It should generate error: cast to union type from type not present in unionbut for u1 = (union u){s1.x,s1.y}; then it would output x = 25 and y = 0.0000

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions