Discussion: Interview question?
Afficher un message
Vieux 02/02/2008, 16h08   #20
Army1987
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Interview question?

Kenny McCormack wrote:

> In article <47a39153$0$36451$4fafbaef@reader5.news.tin.it>,
> Remo D. <rdentato> wrote:
>>pete ha scritto:
>>> Padmat wrote:
>>>> void fn()
>>>> {
>>>> // add ur code only here so that i in main should print OTHER THAN 20
>>>> }
>>>>
>>>> Is there any Leagal solution for this?

>>
>>> void fn(void)
>>> {
>>> printf("OTHER THAN ");
>>> }

>>
>>This wins hands down. Good catch!

> Of course, it leaves open the question as to exactly what the phrase
> "i in main" means.


Of course, i in main is an int, so it cannot print anything at all. But it
is possible that the OP is not a native speaker of English and not very
fluent in it, so he didn't literally mean what he wrote. But, using the
most reasonable interpretation for that, well, in pete's program, "OTHER
THAN 20" *is* printed by the printf which prints the value of i in main
(provided that stdout is either line- or fully buffered), as fn just
writes into a stdio library buffer (it contains no newline character, so
it is not printed until a '\n' is putchar()red or stdout is fflush()ed).

--
Army1987 (Replace "NOSPAM" with "email")
  Réponse avec citation
 
Page generated in 0,05118 seconds with 9 queries