C Interview Questions and Answers


I am sure I have got the trig functions declared correctly, but they are still giving me wrong answers.

You weren't handing them angles in degrees, were you? C's trig functions
(like FORTRAN's and most other languages) accept angles in radians. The conversion
from degrees to radians is simple enough:

sin(degrees * pi / 180)

Posted by:Richards