Archemedian's ghost resides in your comp

cpp India
  • 16 years ago

    can any body explain to me about the strange behaviour of this program



    void main()
    { long a,b,c;
    printf(" \t%ld \t%ld \t%ld \n");
    mark  do not give variables in printf*/


    notice that there are no variables given in the printf statement yet it prints the required values correctly
    (in the reverse order that is ;-) )
    yet how can it happen?
    I discovered this accidently
    the tripplets were being displayed in reverse order . So i decided to change the order of the variables  in the printf statement : But to my utter amazement  i had not at all given the variables in the printf statement

    compile it in Turbo C to get the effect

  • 16 years ago

    I'm afraid it does not work correctly on all machines, depending on the compiler you are using and how memory is allocated/accessed; if I compile it with lcc-win32 I get an absolutely insignificant print, under cigwin it is even worst ...

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Never trust a programmer in a suit.” - Anonymous