Didn't the compiler give you any warning about casting integers to pointers? :-?
BTW: pointers are THE key to efficient programming in C (C++ not so much, but still quite a bit). Take some time to learn all you can about them, they are *very* important.