C语言指针:我这道题哪里错了?
把字符从小到大的顺序排起来.#include "stdio.h"
#include "string.h"
int bb(char*a[],int n)
{ int b,k,i;
char *temp;
for(b=0;b<n-1;b++)
{for(k=b+1;k<n;k++)
{
i=strcmp(a[b],a[k]);
if(i>0)
{temp=a[k];a[k]=a[b];a[b]=temp;}
}
}
}
void main()
{
char *a[3]={"ok","zhan","year"};
int n=3;
bb(a,n);
for(n=0;n<3;n++)
printf("%s\n",a[n]);
}