输入三个字符串,再将最长字符串和最短字符串连接,再将结果输出

输入三个字符串,再将最长字符串和最短字符串连接,再将结果输出。很多报错,请讲解一下

img



#include <stdio.h>
#include <string.h>

void bubble_sort(char a[][100], int n)
{
    int i ,j;
    char temp[100] = {0};
    for(i = 0; i < n - 1; i++)
    {
          for(j = 0; j <n - 1 - i; j++)
         {
            if(strlen(a[j]) < strlen(a[j+1]))
            {
                memset(temp, 0,sizeof(temp));
                memcpy(temp, a[j], strlen(a[j]));
                memset(a[j], 0,sizeof(a[j]));
                memcpy(a[j], a[j+1], strlen(a[j+1]));
                memset(a[j+1], 0,sizeof(a[j+1]));
                memcpy(a[j+1], temp, strlen(temp));
            }
         }
    }
}

int main()
{
    char x[3][100] = {0}, v[100] = {0};
    printf("input 3 str\n");
    scanf("%s%s%s", x[0], x[1], x[2]);
    bubble_sort(x, 3);
    printf("%s\n", strcat(x[0], x[2]));
    return 0;
}

第10行往后的所有[100]都删掉