[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: My First Computer



In article <k2ghebczi9q.fsf@legolas.mdh.se>,
Anders Carlsson  <anders.carlsson@mds.mdh.se> wrote:
>"White Flame \(aka David Holz\)" <whiteflame52@y.a.h.o.o.com> writes:
>
>> Actually, I'd be more prone to write
>> 
>> main()
>> {
>>     while(1)
>>         printf( "Hello\n" );
>> }
>
>A really hardcore programmer might go one step further:
>
>main()
>{
>  while (printf("Hello\n"));
>}
>
>as printf (should) return the number of characters printed, and the
>string "Hello\n" is more than zero characters long. :-)

And if that wasn't the case (i.e. if printf("Hello\n") sometimes
could return zero), you could write:

main()
{
  while( printf("Hello\n"), 1 );
}

Thus you could make an infinite loop outputting an empty string
like this:

main()
{
  while( printf(""), 1 );
}

:-)

-- 
----------------------------------------------------------------
Paul Schlyter,  Swedish Amateur Astronomer's Society (SAAF)
Grev Turegatan 40,  S-114 38 Stockholm,  SWEDEN
e-mail:  pausch at saaf dot se
WWW:     http://hem.passagen.se/pausch/index.html
         http://home.tiscali.se/~pausch/