错误冲突的类型

时间:2014-11-08 19:51:07

标签: c

#include <stdio.h>

 float f(float x){
     float y;
     y = 4/(+x*x);
     return y;
 }

 int intautri(float A, float B, float TOL, int MAXFUN, float *Q, float *E, int *N, float FUN(float)){
    void sort(float [], int);
    void quadra(float, float, float*, float*, float(float));
    float Q1,Q2,c,d,Iold,Eold,E0,E1,E2,alist[100],blist[100],qlist[100],elist[100];
    int n, flag;
    quadra(A, B, &Q1, &E0,FUN);
    *N = 3;
    n = 1;
    alist[n] = A;
    blist[n] = B;
    qlist[n] = Q1;
    elist[n] = E0;
    *Q = Q1;
    *E = E0;
    if (*E<=TOL || *N>=MAXFUN){
        flag = 1;
    }else{
        c = alist[n];
        d = blist[n];
        Iold = qlist[n];
        Eold = elist[n];
        n = n-1;
        quadra(c, (c+d)/2, &Q1, &E1, FUN);
        quadra((c+d)/2, d, &Q2, &E2, FUN);
        *Q = *Q - Iold + Q1 + Q2;
        *E = *E - Eold + E1 + E2;
        *N = *N + 6;
        intautri(A , B, TOL, MAXFUN, Q, E, N, FUN);
        alist[n+1] = c;
        blist[n+1] = (c+d)/2;
        qlist[n+1] = Q1;
        elist[n+1] = E1;
        alist[n+2] = (c+d)/2;
        blist[n+2] = d;
        qlist[n+2] = Q2;
        elist[n+2] = E2;
        n = n+2;
        sort(alist, n);
        sort(blist, n);
        sort(qlist, n);
        sort(elist, n);
        flag = 0;
    };
    return flag;
}


int main(){
     int intautri(float, float, float, int, float *, float *, float *, float(float));
     float TOL, MAXFUN, A, B,*Q,*E;
     int *N, J;
     float f(float);
     A = 0;
     B = 1;
     TOL = 0.0001;
     MAXFUN = 200;
     J = intautri(A, B, TOL, MAXFUN, Q, E, *N, f);
     printf("%d\n", J);
     return 0;
 }`

我有这些错误:

gcc -Wall  -c "untitled1.c" (in directory: /home/user/Desktop)
untitled1.c: In function ‘main’:
untitled1.c:57:7: error: conflicting types for ‘intautri’
   int intautri(float, float, float, int, float *, float *, float *, float(float));
       ^
untitled1.c:9:6: note: previous definition of ‘intautri’ was here
  int intautri(float A, float B, float TOL, int MAXFUN, float *Q, float *E, int *N, float FUN(float)){
      ^
untitled1.c:65:3: warning: passing argument 7 of ‘intautri’ makes pointer from integer without a cast [enabled by default]
   J = intautri(A, B, TOL, MAXFUN, Q, E, *N, f);
   ^
untitled1.c:57:7: note: expected ‘float *’ but argument is of type ‘int’
   int intautri(float, float, float, int, float *, float *, float *, float(float));
       ^
Compilation failed.
你可以帮帮我吗?

1 个答案:

答案 0 :(得分:0)

编译器告诉你确切的情况:

int intautri(float, float, float, int, float *, float *, float *, float(float));

int intautri(float A, float B, float TOL, int MAXFUN, float *Q, float *E, int *N, float FUN(float))

所以你看到float*int*不匹配! (前一个论点)。