来来来,看看哪里错了
程序代码:
#include<stdio.h> #include<string.h> void sort(char *a[], int n) { int i, j, m = 0; char **p, t; p = a + 0; for (i = 0; i < n - 1; i++) { m = i; for (j = i + 1; j < n; j++) if (strcmp(p[m], p[j]) > 0) m = j; if (m != i) { t = *p[i]; *p[i] = *p[m]; *p[m] = t; } } } void print_string(char *a[], int n) { int i; char **p; p = a; for (i = 0; i < n; i++, p++) printf("%s\n", *p); } int main() { void sort(char *a[], int n); void print_string(char *a[], int n); char *a[3] = { "Holle","Welcome","Cart" }; sort(a, 3); print_string(a, 3); return 0; }
装了vs2017 rc后的第一弹