如何将字符串传进指针数组
char* str[100];
char str_tmp[100][100] = { 0 };
for (i = 0; i < n; i++) {
scanf("%s", str_tmp[i]); // 读字符串并传进指针数组
str[i] = str_tmp[i];
}
对指针指向的字符串进行排序
void Exchange(char* str[], int n) {
char* temp;
int i, j, k;
for (i = 0; i < n - 1; i++) { // 选择排序
k = i;
for (j = i + 1; j < n; j++)
if (strcmp(str[k], str[j]) > 0) k = j;
if (k != i) {
temp = str[i];
str[i] = str[k];
str[k] = temp;
}
}
}