Xref: utzoo comp.std.c:1551 comp.lang.c:21045 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!cs.utexas.edu!natinst!rpp386!jfh From: jfh@rpp386.Dallas.TX.US (John F. Haugh II) Newsgroups: comp.std.c,comp.lang.c Subject: Re: A question about the tertiary (? : ) operator Message-ID: <16928@rpp386.Dallas.TX.US> Date: 22 Aug 89 13:28:44 GMT References: <612@cybaswan.UUCP> Reply-To: jfh@rpp386.cactus.org (John F. Haugh II) Followup-To: comp.lang.c Organization: TrishTrash Readers, Inc. Lines: 21 In article <612@cybaswan.UUCP> iiitsh@cybaswan.UUCP (Steve Hosgood) writes: >I never noticed until last night that the conditional operator: > >? : > >..is not a valid lvalue, even if both and are lvalues! >I wanted to say: > >(flag > 0? foo: bar) = ; > >..which didn't work, needless to say. I had to employ a temporary variable >and an 'if' statement in the end :-(. There is a way to do this ... *((type_of_foobar *) flag > 0 ? &foo:&bar) = -- John F. Haugh II +-Quote of the month club: ------------ VoiceNet: (512) 832-8832 Data: -8835 | Speaking of Netnews Administration: InterNet: jfh@rpp386.cactus.org | "If Bill Vajk can do it, anyone can" UUCPNet: {texbell|bigtex}!rpp386!jfh +--------- -- Patricia O Tuama-----