home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!crdgw1!rdsunx.crd.ge.com!bart!volpe
- From: volpe@bart.NoSubdomain.NoDomain (Christopher R Volpe)
- Newsgroups: comp.lang.c
- Subject: Re: Question to test general C knowledge
- Message-ID: <1992Dec11.180939.20726@crd.ge.com>
- Date: 11 Dec 92 18:09:39 GMT
- References: <Bz0A46.Cvu@watserv1.uwaterloo.ca> <19980@ksr.com> <1992Dec11.091819.26636@thunder.mcrcim.mcgill.edu>
- Sender: volpe@bart (Christopher R Volpe)
- Reply-To: volpe@ausable.crd.ge.com
- Organization: GE Corporate Research & Development
- Lines: 35
- Nntp-Posting-Host: bart.crd.ge.com
-
- In article <1992Dec11.091819.26636@thunder.mcrcim.mcgill.edu>, mouse@thunder.mcrcim.mcgill.edu (der Mouse) writes:
- |> In article <19980@ksr.com>, jfw@ksr.com (John F. Woods) writes:
- |> > dmeister@mansci1.UWaterloo.ca (Darren Meister) writes:
- |> >> [I]f you could ask someone one question to test if they generally
- |> >> understand C what would it be[?]
- |>
- |> > "After
- |> > int i = 2;
- |> > i = ++i;
- |> > what does i equal?"
- |>
- |> > If they answer, do not hire them.
- |>
- |> Hm?
- |>
- |> "Anything or nothing. 3 seems most probable, with 4 next."
- ^^^^^^^^^^^^
-
- Why? The effect of the "++" is to assign 3 to i. And since the value of
- the "++i" expression is 3, the effect of the "=" is to assign 3 to i.
- Under what conditions would any other value be expected? (Other than,
- of course, a vindictive compiler that detected violations of the letter
- of the law and went out of its way to give you garbage.)
-
-
- |>
- |> der Mouse
- |>
- |> mouse@larry.mcrcim.mcgill.edu
-
- --
- ==================
- Chris Volpe
- G.E. Corporate R&D
- volpecr@crd.ge.com
-