Code:#include<stdio.h> #include<math.h> void algo(int); main() { algo(5); } void algo(int k) { printf("%f",sqrt(k)); }
Code:#include<stdio.h> #include<math.h> void algo(int); main() { algo(5); } void algo(int k) { printf("%f",sqrt(k)); }
You need to link to the math library explicitly...
by the
-lm
flag for ld.
Here's the To Do list from the FAQ page. The one(s) that I'm considering right now are the "using multiple files in C" and the related, possibly in the same article, explanation/use of the extern keyword. Take anything else on the list that needs doing, or just write one that you feel is needed based on your experience here.
EDIT: It looks like the FAQs haven't been touched in a while, but I don't see that as a reason to not work on them.
There is a new function in C99 that finds the square root of a long.I might be ashamed of myself if I wasn't chuckling so much.Code:#define I int I chooseYou = sqrtl( 0xDL );
Quzah.
Last edited by quzah; 08-26-2011 at 04:08 PM. Reason: #define fail, too tired
Hope is the first step on the road to disappointment.
Ahh, Pokemon. It was after my time, and I don't have kids yet.
In that case, very well played Quzah. Went right over my head, but I'm short, so it happens a lot.
Hope is the first step on the road to disappointment.