错误预期)

时间:2013-03-09 13:05:08

标签: c

您可以帮我解决一下我的代码:

    typedef struct term{
        char var[10];
        int val[8];
    }TERM;

    TERM termx[50];
    int initialize();
    int a[15],b[15],c[15];

    int check(TERM termx[].var[],int i){
    int j;
    const char* const StringArray[NrOfStrings] =
        {
      "ABC","ABC'","AB'C'","A'B'C'","A'B'C","A'BC'","AB'C",
      "AB+C","A'B'+C'","A'B'+C","A'B+C'","AB'+C'","AB'+C","
      "A+BC","A'+B'C'","A'+B'C","A'+BC'","A+B'C'","A+B'C",
        };
    for(j=0;j<NrOfStrings;j++){
        if(stcmp(term[i].var,StringArray[j])==0){
            return(j);
            break;
            }
        }

    }
void main(){
int x,i,j,key;
char y[10];
    initialize();
    clrscr();
    printf("Enter the number of terms: ");
    scanf("%d",&x);
        for(i=0;i<x;i++){
        printf("Enter the %d term: ",i+1);
        scanf("%s",termx[i].var);
            for(j=0;j<strlen(termx[i].var);j++)
                termx[i].var[j]=changeToupper(termx[i].var[j],i,j);
        key=check(termx[i].var,i);
       }   
    printf("\nA\tB\tC\n\n");
    for(i=0;i<8;i++)
        printf("%d\t%d\t%d\n",a[i],b[i],c[i]);
    getch();

}

它给了我预期的')'错误,它指向函数check()的参数。我知道这是一个常见的错误,但我试图搜索谷歌但无法找到解决方案。我希望你能帮助我。谢谢

1 个答案:

答案 0 :(得分:1)

该行

int check(TERM termx[].var[],int i){

应该是

int check(TERM *term,int i){

然后

key=check(termx[i].var,i);

应该阅读

key=check(termx[i],i);