When I don’t declare a function protype and have a single function, it runs. However, when I have more than one function than it gives me the error:
type mismatch in redeclaration of “function-name”
#include <conio.h>
#include <stdio.h>
float area1(float, float);
float area (float, float);
void main()
{
float x;
float y;
float a;
float z;
clrscr();
x = 5.0;
y = 5.0;
z = area(x, y);
a = area1(x, y);
printf("%f", z);
printf("%f", a);
getch();
}
void area(float a, float b)
{
int c;
c = 0.5 * a * b;
return c;
}
void area1(float a, float b)
{
int c;
c = 0.5 * a * b;
return c;
}
you should Write the functions in basically reverse order, with the lowest level functions at the beginning of the file, and higher level functions (that use the lower level ones) following.and Use separate prototypes (typically in a header) preceding the implementations of the functions.