fork download
  1. #import <Foundation/Foundation.h>
  2.  
  3. union mixed {int i; float f; char c;};
  4.  
  5. int main() {
  6.  
  7. union mixed x;
  8. x.i = 5;
  9. NSLog(@"%d", x.i);
  10. x.f = 2.5;
  11. NSLog(@"%f", x.f);
  12. x.c = 'A';
  13. NSLog(@"%c", x.c);
  14.  
  15. return 0;
  16. }
Success #stdin #stdout #stderr 0.03s 42848KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
2016-05-02 11:25:28.740 prog[18238] 5
2016-05-02 11:25:28.741 prog[18238] 2.500000
2016-05-02 11:25:28.741 prog[18238] A