S
somebody
Okay, I bought "C in a Nutshell", and attempted to compile
the first example. When I attempt to compile this simple
program, I get these two errors:
gcc circle.c -o circle
circle.c:29: error: conflicting types for 'circularArea'
circle.c:13: error: previous implicit declaration of 'circularArea' was here
I've included the actual program below. They types are all doubles,
so I don't see how there are any conflicting types.
#include <stdio.h>
int main()
{
double radius = 1.0, area = 0.0;
printf( " Areas of Circles\n\n" );
printf( " Radius Area\n"
"-------------------------\n" );
area = circularArea( radius );
printf( "%10.1f %10.2f\n", radius, area );
radius = 5.0;
area = circularArea( radius );
printf( "%10.1f %10.2f\n", radius, area );
return 0;
}
/*The function circularArea( ) calculates the area of a circle*/
/*Parameter: The radius of the circle*/
/*Return value: The area of the circle*/
double circularArea( double r ) // Definition of circularArea( ) begins
{
const double pi = 3.1415926536; // Pi is a constant
return pi * r * r;
}
the first example. When I attempt to compile this simple
program, I get these two errors:
gcc circle.c -o circle
circle.c:29: error: conflicting types for 'circularArea'
circle.c:13: error: previous implicit declaration of 'circularArea' was here
I've included the actual program below. They types are all doubles,
so I don't see how there are any conflicting types.
#include <stdio.h>
int main()
{
double radius = 1.0, area = 0.0;
printf( " Areas of Circles\n\n" );
printf( " Radius Area\n"
"-------------------------\n" );
area = circularArea( radius );
printf( "%10.1f %10.2f\n", radius, area );
radius = 5.0;
area = circularArea( radius );
printf( "%10.1f %10.2f\n", radius, area );
return 0;
}
/*The function circularArea( ) calculates the area of a circle*/
/*Parameter: The radius of the circle*/
/*Return value: The area of the circle*/
double circularArea( double r ) // Definition of circularArea( ) begins
{
const double pi = 3.1415926536; // Pi is a constant
return pi * r * r;
}