fork download
  1. #include <stdio.h>
  2. union Data{
  3. int i;
  4. float f;
  5. char ch;
  6. };
  7.  
  8. int main(void) {
  9. union Data d;
  10. d.i=10;
  11. printf("integer value: %d\n", d.i);
  12. d.f=2.4;
  13. printf("float value: %2.f\n", d.f);
  14.  
  15. d.ch= 'R';
  16. printf("char value :%c\n",d.ch);
  17.  
  18. // your code goes here
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
integer value: 10
float value:  2
char value :R