Originally Posted by
itCbitC
While you are at it, I would suggest that you turn on compiler warnings:
Code:
gcc -Wall -W -pedantic yourprogam.c -o yourprogram -lm
You might see some helpful stuff like
Code:
yourprogram.c: In function ‘main’:
yourprogram.c:9: warning: format ‘%f’ expects type ‘float *’, but argument 2 has type ‘double *’
Watchtower's suggestion tells you how to fix it, but I think it's nice that the compiler can give you a hint that there's a problem so you know where to look (in case Watchtower is not around when you wonder why you get the wrong answer from the program).
D.