Reputation: 103
As part of a wider project I am given an angle in degrees that needs to be converted to radians for some calculation.
So far, I have the following:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
feature1()
{
double angle = 90.0000, angle2;
angle2 = convert_to_rad(angle);
printf("%lf", &angle);
}
double convert_to_rad(double angle_in_deg)
{
double angle_in_rad;
angle_in_rad = (angle_in_deg * M_PI) / 180;
return angle_in_rad;
}
When compiling the file in NetBeans I get the following errors:
note: previous implicit declaration of 'convert_to_rad' was here.
error: conflicting types for 'convert_to_rad
Upvotes: 0
Views: 1844
Reputation: 59987
Why not fix the formatting?
Anyhow use a forward declaration.
i.e. place
double convert_to_rad(double angle_in_deg);
At the start (before feature1
function)
Upvotes: 7