Hi,
what's the floor function in C?
I tried floor() it did not work.
Hi,
what's the floor function in C?
I tried floor() it did not work.
I did not forget : #include <math.h>
I get: undefined reference to `floor'
floor() is part of math.h. If gcc is your compiler, you also need to use -lm to link to the math library. Then you can use, eg. "float x=floor(3.7f);"
ps, C rounds down by default, so "int x=3.7" means x==3
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
thanks MK27
-lm was the problem