Page 1 of 1

...42

Posted: Wed Apr 13, 2005 11:24 pm
by Bdw3

Code: Select all

#define SIX    1 + 5
#define NINE   8 + 1

int main(void)
{
    printf( "What you get if you multiply six by nine: %d\n", SIX * NINE );
    return 0;
}
Silly computer! :lol:

Posted: Wed Apr 13, 2005 11:26 pm
by LeonardoP
hmmm so you multiply 6, times, 9.. titillating.

Posted: Wed Apr 13, 2005 11:33 pm
by Bdw3
6 times 9 is 54....

Posted: Wed Apr 13, 2005 11:34 pm
by LeonardoP
how come you're so sure?!

Posted: Wed Apr 13, 2005 11:37 pm
by Bdw3
Because it is... :dork:

the above code returns 42 as the answer because it sort of borkes the order of operations, but dosen't...

1 + 5 * 8 + 1

it dosen't sum the two definitions first.

Posted: Wed Apr 13, 2005 11:39 pm
by LeonardoP
but you could be wrong too, you can never be sure.

Posted: Wed Apr 13, 2005 11:40 pm
by LeonardoP
don't try to trick me man, i don't like that shit

Posted: Wed Apr 13, 2005 11:41 pm
by Bdw3

Posted: Wed Apr 13, 2005 11:42 pm
by phantasmagoria
BODMAS

Posted: Wed Apr 13, 2005 11:42 pm
by Bdw3
:icon28:

Posted: Wed Apr 13, 2005 11:42 pm
by phantasmagoria
BRACKETS OVER DIVISION MULTIPLICATION ADDITION AND SUBTRATION

Posted: Wed Apr 13, 2005 11:43 pm
by phantasmagoria
bunny said so



:icon10:

Posted: Wed Apr 13, 2005 11:44 pm
by Bdw3
Thought that was a horse pig... 0.o

Posted: Wed Apr 13, 2005 11:44 pm
by phantasmagoria
http://www.frozenreality.co.uk/comic/bunny/

horse pig? HORSE PIG?! bunny for one, was offended

Posted: Wed Apr 13, 2005 11:44 pm
by LeonardoP
i don't believe you guys. i know for a fact that google isn't the answer.

Posted: Wed Apr 13, 2005 11:45 pm
by Bdw3
:lol:

Posted: Thu Apr 14, 2005 12:37 am
by ^misantropia^
* computer nerd steps in *

1 + 5 * 8 + 1 gets evaluated as 1 + (5 * 8) + 1 == 42. This code snippet is evil. The #defines should've been written as:

Code: Select all

#define SIX    (1 + 5)
#define NINE   (8 + 1)
But it's funny. A little.

* computer nerd steps out *

Posted: Thu Apr 14, 2005 1:17 am
by Bdw3
:icon26:

Posted: Thu Apr 14, 2005 2:13 am
by losCHUNK
so if 9 is 4 and 4 is 9 and 3 is somewhere in afganistan, then whats 24

Posted: Thu Apr 14, 2005 2:15 am
by Scourge
losCHUNK wrote:so if 9 is 4 and 4 is 9 and 3 is somewhere in afganistan, then whats 24
About the right amount of beers.