Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. typedef union {
  2.     int i;
  3.     float f;
  4. } ambivalent_union;
  5.  
  6. //My plan is for this macro to work for both ints and floats.
  7. #define MY_MACRO( some_expression ) \
  8.     ambivalent_union u = (ambivalent_union)(some_expression); \
  9.     printf("If the expression returned a float, it would be %f", ambivalent_union.f); \
  10.     printf("If the expression returned an int, it would be %d", ambivalent_union.i);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement