Compiler prompt “[Error] invalid conversion from ‘int’ to ‘int*’ [-fpermissive]”

  Kiến thức lập trình

I compiled the following code using TDM-GCC 4.9.2 64-bit Release (the one built into Bloodshed Dev-C++):

#include <iostream>
using namespace std;
const int MAXN=1005;
int a[MAXN],b[MAXN],c[MAXN];

void input(int a[]){
    string s;
    cin >> s;
    int len=s.length();
    for(int i=0;i<MAXN;i++) a[i]=0;
    for(int i=len-1;i>=0;i-=4){
        a[0]++;
        for(int j=max(0,i-3);j<=i;j++){
            a[a[0]] *= 10;
            a[a[0]] += s[j]-'0';
        }
    }
}

void output(int a[]){
    for(int i=a[0];i;i--){
        if(i==a[0])
            cout << a[i];
        else{
            int tmp=1000;
            for(int j=1;j<=4;j++){
                cout << a[i]/tmp%10;
                tmp /= 10;
            }
        }
    }
}

void add(int c[],int a[],int b[]){
    for(int i=0;i<MAXN;i++) c[i]=0;
    c[0]=max(a[0],b[0]);
    for(int i=1;i<=c[0];i++){
        if(i<=a[0]) c[i]+=a[i];
        if(i<=b[0]) c[i]+=b[i];
    }
    for(int i=1;i<=c[0];i++){
        c[i+1] += c[i]/10000;
        c[i] %= 10000;
    }
    while(c[c[0]+1]>0){
        c[0]++;
        c[c[0]+1] = c[c[0]]/10000;
        c[c[0]] %= 10000;
    }
}

int main(){
    int t,c=0;
    cin >> t;
    for(int r=0;r<t;t++){
        input(a);
        input(b);
        add(c,a,b);
        cout << "Case " << ++c << ":" << endl;
        output(a);
        cout << " + ";
        output(b);
        cout << " = ";
        output(c);
        cout << endl << endl;
    }
    return 0;
}

Here’s a piece of high-precision addition code written for this problem.
When I compile, the compiler reports the following error:
error
I am not aware of this error, how can I fix it please?

LEAVE A COMMENT