Mailing List Archive


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

Re: [tlug] C puzzle



>>>>> "br" == bruno raoult <br@example.com> writes:

    br> How to get 21 "-" chars output?
    >> 
    >> for(i = 0 ;~i < n ; i--)

    br> Hi Viktor,

    br> You got it. And *sumimasen* again for the second one (to get 1
    br> char output only) :)

    br> By the way, how did you find the "~" astuce? This solution
    br> always gives me an impression of "random try".  :)

Well, I'll be honest:) I posted the puzzle on a local C/C++ mailing
list, and somebody (without giving a correct replacement) answered
that ~ prints 21 '-'. BTW, you can test the level of a list with this
puzzle. TLUG won ;)

But if you think about it, inversion of a number has something to do
with changing its sign...

Viktor


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links