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.02s 42848KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
2016-05-02 11:29:28.187 prog[24163] 5
2016-05-02 11:29:28.188 prog[24163] 2.500000
2016-05-02 11:29:28.188 prog[24163] A