any chance that actually said implicitly defined? If so I suspect that the problem is that you are calling your functions before defining them. To fix this you have 2 options:
1.reorder - for this solution, you will want to make sure that no functions are used before being created. In your case the problem would be using get_input()
in main
.
#include <stdio.h>
double get_input(void)
{
double x1;
printf("Enter any number: ");
scanf("%lf", &x1);
return x1;
}
double get_next(double x2,double x1)
{
double total;
total=(((x2)/2)+3(x1));
return total;
}
void print_result(void)
{
return null;
}
double main(void)//move main to the bottom
{
get_input();
get_input();
}
2.prototypes
#include <stdio.h>
double_getinput(void);
double get_next(double x2, double x1);//double get_next(double, double); also works, I just think this looks better
void print_result();
double main(void)
{
get_input();
get_input();
}
double get_input(void)
{
double x1;
printf("Enter any number: ");
scanf("%lf", &x1);
return x1;
}
double get_next(double x2,double x1)
{
double total;
total=(((x2)/2)+3(x1));
return total;
}
void print_result(void)
{
return null;
}
Also, main should always look like one of the following:
1
!implicit void param~ (Apparently invalid)
int main(){//
...
return 0;
}
explicit void param (a little less common, but I would recommend this for you)
int main(void){
...
return 0;
}
explicit command line args (second most common)
int main(int argc, char *argv){
...
return 0;
}
NOTE: the int
is also optional for all of these forms. For example (I HIGHLY discourage this option):
main(void){
...
return 0;
}
EDIT
the reason main
should be formatted like this Regarding 'main(int argc, char *argv[])'