#include <stdio.h>
#include <stdlib.h>
main() {
    int j, u[23] = {0};
    while (!u[19]) {
        while (u[j = rand() % 23]++)
            ;
        putchar("uatChks rteJ r hon,\neca"[j]);
    }
}
Is an obfuscated piece of code meant to print
Just another C hacker,
It works in two different online compilers/interpreters I've tried (ideone.com and codepad.org) but not when I run it with GCC.
When I build it and run it using GCC, it prints:
,cthehasok tre anu
On my computer, I am building it with this command:
gcc C:\Programming\c\JACH.c -o JACH
I think the problem is to do with the rand() function, and maybe the RAND_MAX macro:
In my compiler, RAND_MAX is defined as 32767, whereas on ideone.com, it is 2147483647. I'm not sure if that actually has anything to do with it, but I'm convinced that rand() is the problem, after running tests such as this:
srand(0);
int i;
for (i=1;i<4;i++) {
    printf("%d: %d\n", i, rand() % 23);
}
This code produced very different results across compilers,
gcc:
1: 15
2: 14
3: 9
ideone.com:
1: 11
2: 0
3: 6
Does anyone know how I can force my compiler to provide the same results as ideone.com/online compilers?