在b站跟著青島大學老師學習時報錯 不知道為什么
編譯器是VC++6.0
下面是源代碼
#include<stdio.h>
typedef struct
{
float realpart;/*實部*/
float imagpart;/*虛部*/
}Complex; /*定義復數的抽象型別*/
void assign(Complex *A,float real,float imag); /*賦值*/
void add(Complex *c,Complex A,Complex B); /*A+B*/
void minus(Complex *c,Complex A,Complex B); /*A-B*/
main()
{
Complex z1,z2,z;
float realpart,imagpart;
assign(z1,8.0,6.0);
assign(z2,4.0,3.0);
add(z,z1,z2);
}
void assign(Complex *A,float real,float imag)
{
A->realpart=real; /*實部賦值*/
A->imagpart=imag; /*虛部賦值*/
}
void add(Complex *c,Complex A,Complex B)
{
c->realpart=A.realpart+B.realpart; /*實部相加*/
c->imagpart=A.imagpart+B.imagpart; /*虛部相加*/
}
void minus(Complex *c,Complex A,Complex B)
{
c->realpart=A.realpart-B.realpart; /*實部相減*/
c->imagpart=A.imagpart-B.imagpart; /*虛部相減*/
}
D:\新建檔案夾\676756856\689787896.c(14) : error C2115: 'function' : incompatible types
D:\新建檔案夾\676756856\689787896.c(14) : warning C4024: 'assign' : different types for formal and actual parameter 1
D:\新建檔案夾\676756856\689787896.c(15) : error C2115: 'function' : incompatible types
D:\新建檔案夾\676756856\689787896.c(15) : warning C4024: 'assign' : different types for formal and actual parameter 1
D:\新建檔案夾\676756856\689787896.c(16) : error C2115: 'function' : incompatible types
D:\新建檔案夾\676756856\689787896.c(16) : warning C4024: 'add' : different types for formal and actual parameter 1
求助大神 輕點噴。。。
uj5u.com熱心網友回復:
噴在哪兒?是用滑鼠點么?In function main, you called other function with a "value" as the 1st argument,
but that function needs an "address" here.
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/267709.html
標籤:新手樂園
上一篇:求助
下一篇:求大佬看看
