thats probably why it is crashing. time wants a pointer and it is getting garbage. it compiles because it doesn't have the prototypes for time and rand so it defaults.