home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / c / 11518 < prev    next >
Encoding:
Text File  |  1992-07-23  |  1.2 KB  |  41 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!utcsri!skule.ecf!torn!cunews!csi.uottawa.ca!news
  3. From: cbbrowne@csi.uottawa.ca (Christopher Browne)
  4. Subject: Re: initiaklizing union members
  5. Message-ID: <1992Jul23.143008.20768@csi.uottawa.ca>
  6. Sender: news@csi.uottawa.ca
  7. Nntp-Posting-Host: prgv
  8. Organization: Dept. of Computer Science, University of Ottawa
  9. References: <1708@toro.MTS.ML.COM> <5391@dsacg3.dsac.dla.mil>
  10. Distribution: usa
  11. Date: Thu, 23 Jul 92 14:30:08 GMT
  12. Lines: 27
  13.  
  14. In article <5391@dsacg3.dsac.dla.mil> nto0302@dsacg3.dsac.dla.mil (Bob Fisher) writes:
  15. >From article <1708@toro.MTS.ML.COM>, by scott@toro.MTS.ML.COM (Scott Strool):
  16. >| How can I initialize a struct that contains a union member.
  17. >| If I have a struct as defined:
  18. >| 
  19. >| struct Row {
  20. >|     int Type;
  21. >|     union {
  22. >|         int ival;
  23. >|         char* sval;
  24. >|         } value;
  25. >|     };
  26. >| 
  27. >| how would i set value with a static declaration:
  28. >| 
  29. >| static Row r0 = { 0, 1234 };
  30. >| static Row r1 = { 1, "string" };
  31. >| 
  32. >| This does not work!
  33.  
  34. Maybe if you get the structs to sign their union cards, you might have
  35. better success.  Then head office would be able to properly deduct the
  36. -- 
  37. Christopher Browne
  38. cbbrowne@csi.uottawa.ca
  39. University of Ottawa
  40. Master of System Science Program
  41.