请问这个代码错误该怎么改啊

#include<stdio.h>
#include<string.h>
#define maxsize 80

void match(char c[][maxsize],int m)   ///二维数组c的行数为n
{
    bool findout=false;             ///是否找到公共串
    char ans[maxsize];              ///存放找到的公共串
    strcpy(ans,"Z");                ///初始化ans,因为题目中字符串的字母只有ATGD
    for(int i=60; i>=3; i--) ///枚举所有子串,长度i,从大到小,因为要求的是最长的公共子串
    {
        for(int j=0; j<=60-i; j++)  ///枚举所有长度为i的字串
        {
            char pattern[maxsize];  ///存放每次枚举的子串
            int cnt=0;              ///记录与后面字符串匹配的字符串的个数
            strncpy(pattern,c[0]+j,i);   ///枚举子串
            pattern[i]='\0';
            for(int k=1; k<m; k++)   ///在剩下的碱基序列中查找是否有该子串
            {
                if(strstr(c[k],pattern)) cnt++;
                else break;
            }
            if(cnt==m-1 && strcmp(ans,pattern)>0) ///如果都有pattern子串并且比原有的ans字典 
                                                  ///序小,则拷贝给ans
                strcpy(ans,pattern),findout=true;
        }
        if(findout)         ///如果长度为i的子串都匹配成功,
                            ///直接打印,因为从大到小枚举,得到的肯定是最长的
        {
            printf("%s\n",ans);
            return;
        }
    }
    strcpy(ans,"no significant commonalities");
    printf("%s\n",ans);
}

int main()
{
    int n;
    scanf("%d",&n);
    while(n--)
    {
        int m;
        scanf("%d",&m);
        char c[m][maxsize];
        for(int i=0; i<m; i++)
        {
            scanf("%s",c[i]);
        }
        match(c,m);
    }
    return 0;
}

img


这里的m没有声明过

你代码错误太多了,你的目的是什么?
参考如下:

#include<stdio.h>
#include<string.h>
#include <stdlib.h>
#define maxsize 80

void match(char c[][maxsize],int m) ///二维数组c的行数为n
{
    bool findout=false; ///是否找到公共串
    char ans[maxsize]; ///存放找到的公共串
    strcpy(ans,"Z"); ///初始化ans,因为题目中字符串的字母只有ATGD
    for(int i=60; i>=3; i--) ///枚举所有子串,长度i,从大到小,因为要求的是最长的公共子串
    {
        for(int j=0; j<=60-i; j++) ///枚举所有长度为i的字串
        {
            char pattern[maxsize]; ///存放每次枚举的子串
            int cnt=0; ///记录与后面字符串匹配的字符串的个数
            strncpy(pattern,c[0]+j,i); ///枚举子串
            pattern[i]='\0';
            for(int k=1; k<m; k++) ///在剩下的碱基序列中查找是否有该子串
            {
                if(strstr(c[k],pattern)) cnt++;
                else break;
            }
            if(cnt==m-1 && strcmp(ans,pattern)>0) ///如果都有pattern子串并且比原有的ans字典
                ///序小,则拷贝给ans
                strcpy(ans,pattern),findout=true;
        }
        if(findout) ///如果长度为i的子串都匹配成功,
            ///直接打印,因为从大到小枚举,得到的肯定是最长的
        {
            printf("%s\n",ans);
            return;
        }
    }
    strcpy(ans,"no significant commonalities");
    printf("%s\n",ans);
}

int main()
{
    int n,i=0;
    char c[maxsize][maxsize]={0};
    scanf("%d",&n);
    //scanf("%d",&m);
    while(i<n)
    {
        //int m;
        //scanf("%d",&m);
        //char c[m][maxsize];
        //for(int i=0; i<m; i++)
        //{
            scanf("%s",c[i]);
        //}
        //match(c,m);
        i++;
    }
    match(c,n);
    return 0;
}