Advertisement
Guest User

stackoverflow.com/questions/49711582

a guest
Apr 7th, 2018
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. struct data_unit {
  2. enum {
  3. d_A, d_B, d_C
  4. } dtype;
  5. union {
  6. char * a;
  7. int * b;
  8. double * c;
  9. } data;
  10. };
  11.  
  12. char * du_format_table = {"%c", "%d", "%lf"};
  13.  
  14. void print_data_unit(data_unit du){
  15. printf(format_table[du.dtype], du.data.a + du.dtype);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement