double sin(double x)
Is a function declared in the math.h header. It can be used anywhere you’d like – in main() or in any other function you write that is called within main(). However, the way you show it called in main will not do anything useful. The sin() function takes a double as an input and returns a double as an output, so you must store this result in order to do anything with it. For example:
#include <math.h>
void main()
{
double x, y;
x = 3.14159;
y = sin(x);
}
Now y contains the value of the sine of x, which in this case would be 0.
0
solved How to run the sin(double x) method in C