home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!utcsri!skule.ecf!torn!cunews!csi.uottawa.ca!news
- From: cbbrowne@csi.uottawa.ca (Christopher Browne)
- Subject: Re: initiaklizing union members
- Message-ID: <1992Jul23.143008.20768@csi.uottawa.ca>
- Sender: news@csi.uottawa.ca
- Nntp-Posting-Host: prgv
- Organization: Dept. of Computer Science, University of Ottawa
- References: <1708@toro.MTS.ML.COM> <5391@dsacg3.dsac.dla.mil>
- Distribution: usa
- Date: Thu, 23 Jul 92 14:30:08 GMT
- Lines: 27
-
- In article <5391@dsacg3.dsac.dla.mil> nto0302@dsacg3.dsac.dla.mil (Bob Fisher) writes:
- >From article <1708@toro.MTS.ML.COM>, by scott@toro.MTS.ML.COM (Scott Strool):
- >| How can I initialize a struct that contains a union member.
- >| If I have a struct as defined:
- >|
- >| struct Row {
- >| int Type;
- >| union {
- >| int ival;
- >| char* sval;
- >| } value;
- >| };
- >|
- >| how would i set value with a static declaration:
- >|
- >| static Row r0 = { 0, 1234 };
- >| static Row r1 = { 1, "string" };
- >|
- >| This does not work!
-
- Maybe if you get the structs to sign their union cards, you might have
- better success. Then head office would be able to properly deduct the
- --
- Christopher Browne
- cbbrowne@csi.uottawa.ca
- University of Ottawa
- Master of System Science Program
-