Add the -W and -Wall flags to your gcc command.
Do you get any warnings doing that?
EDIT: I should mention that your program works fine for me.
Type: Posts; User: oogabooga
Add the -W and -Wall flags to your gcc command.
Do you get any warnings doing that?
EDIT: I should mention that your program works fine for me.
Compiling with full warning should ferret out that possibility.
With gcc, use:
gcc -W -Wall yourprog.c
Yeah, I should have looked that up first. :)
As for your point, it turns out that drand48 (and srand48) are declared in stdlib.h.
I guess it's okay to add things to a standard library header.
Could it be because you're using %lf in fprintf whereas you should be using %f ?