Wednesday, December 5, 2007

GCC rocks

Puzzle of the day in the office:
#include <iostream>

using namespace std;

int main() {
int j = 2;
cout << -1 * abs(j - 1) << endl;
return 0;
}

1) What does this program print?
2) What the hell is going on?

3 comments:

  1. Join the club.

    http://jerom.livejournal.com/120844.html?nc=15
    http://pg.livejournal.com/12287.html?nc=9

    ReplyDelete
  2. Пока комменты у pg не прочел, не врубился :)
    gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)

    ReplyDelete