home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!mksol!mccall
- From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
- Subject: Re: Question to test general C knowledge
- Message-ID: <1992Dec18.181806.28952@mksol.dseg.ti.com>
- Organization: Texas Instruments Inc
- References: <rfries.150@sceng.ub.com> <rfries.151@sceng.ub.com> <1992Dec18.093717.7661@jussieu.fr> <BzGoGn.A93@cck.coventry.ac.uk>
- Date: Fri, 18 Dec 1992 18:18:06 GMT
- Lines: 42
-
- In <BzGoGn.A93@cck.coventry.ac.uk> champion@cch.coventry.ac.uk (Alun) writes:
-
- >In article <1992Dec18.093717.7661@jussieu.fr> fred@trot.ibp.fr (Frederic PETROT) writes:
- >~d_north@ondec.lonestar.org (David G. North, CCP) writes:
- >~>Or better yet, what is the type and value of the following expression:
- >~> "this is a test"[4]
- >~
- >~try this one (due to a friend of mine):
- >~
- >~main()
- >~{
- >~ printf("%c", unix["abc"]);
- >~}
- >~
-
- >Why does this print 'b' ??
- >I could understand the indexing with numbers but with [unix] ??
-
- I would suspect that thec compiler in question does a '#define unix 1'
- to indicate to itself (and programs) that it is in a UNIX environment.
- So what you're really doing is indexing the [1] element of the string
- "abc", which gets you the character 'b'.
-
- >Please help a confused individual.
-
- >I consider myself competent with the C and find it difficult to understand
- >why anyone would ask these type of questions in an interview - surely these
- >don't show someones level of competence.
-
- I consider such quizes to be a waste of time in general, and quizes
- over 'tricks' to be even more worthless.
-
- [I've always considered myself competent, but certainly no guru; yet I
- can answer pretty much all of these. See what reading comp.lang.c and
- the FAQ for a long time will do for you? Or should that be 'to you'?
- ;-)]
-
- --
- "Insisting on perfect safety is for people who don't have the balls to live
- in the real world." -- Mary Shafer, NASA Ames Dryden
- ------------------------------------------------------------------------------
- Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.
-