change the array initialization
This commit is contained in:
parent
a708a56310
commit
66238736d8
|
@ -32,10 +32,11 @@ int main(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void sort(char **arr, int n) {
|
void sort(char **arr, int n) {
|
||||||
|
char *tmp;
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
for (int j = 0; j < n - 1; j++) {
|
for (int j = 0; j < n - 1; j++) {
|
||||||
if (strcmp(arr[j], arr[j + 1]) > 0) {
|
if (strcmp(arr[j], arr[j + 1]) > 0) {
|
||||||
char *tmp = arr[j];
|
tmp = arr[j];
|
||||||
arr[j] = arr[j + 1];
|
arr[j] = arr[j + 1];
|
||||||
arr[j + 1] = tmp;
|
arr[j + 1] = tmp;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue