对字符串(英文)从小到大排序

//arr 要排序的字符串数组
//n 字符串数组字符串数
//采用冒泡排序

void sortString(char (*arr)[10],int n){
    for (int i = 0; i < n - 1; i++) {
        for (int j = 0; j < n - 1 - i; j++) {
            if(strcmp(arr[j], arr[j+1]) > 0){
                char a[10] = {0};
                strcpy(a, arr[j]);
                strcpy(arr[j], arr[j+1]);
                strcpy(arr[j+1], a);
            }
        }
    }
}

原文地址:https://www.cnblogs.com/Ager/p/4799101.html