C语言结构提示错误,怎么修改


#include<stdio.h>

struct funds
{ 
double current; 
double savings;
};
double sum (struct funds);

main()
{ 

struct funds ABC; 
ABC.current = 1005;
ABC.savings = 34.5;
printf("Total funds in ABC %lf",sum(ABC));
}


img

sum(ABC)在哪里实现的?代码修改如下:




#include<stdio.h>
struct funds
{ 
    double current; 
    double savings;
};
double sum (struct funds);
int main()
{ 
    struct funds ABC; 
    ABC.current = 1005;
    ABC.savings = 34.5;
    printf("Total funds in ABC %lf",sum(ABC));
    return 0;
}

double sum(struct funds ABC)
{
    return ABC.current + ABC.savings;
}

缺少方法的实现。
double sum (struct funds);
代码如下:

#include<stdio.h>
struct funds
{ 
double current; 
double savings;
};
double sum (struct funds);
main()
{ 
struct funds ABC; 
ABC.current = 1005;
ABC.savings = 34.5;
printf("Total funds in ABC %.2lf",sum(ABC));
}

double sum(struct funds ABC)
{
    return ABC.current + ABC.savings;
}

函数值有申明,没有实现啊,改为

double sum (struct funds f)
{
    return f.current + f.savings;
}

sum 函数都没有定义


double sum(struct funds fund){
    return fund.current + fund.savings;
}