Home > Back-end >  Help you look
Help you look

Time:09-29

Why the first function can run, the second one is wrong?
Topic is: subject to 5 string after the smallest output (using the pointer array implementation),
Void fsort (char * color [], int n)
{
int i,j,k;
Char b [80];
for(i=0; i{
For (j=I + 1; j{
If (STRCMP (color [I], color [j]) & gt; 0)
{
Strcpy (b, color + I);
Strcpy (color + I, color + j);
Strcpy (color + j, b);
}
}
}
}
Void fsort (char color, int n)
{
int i,j,k;
Char b [80];
for(i=0; i{
For (j=I + 1; j{
If (STRCMP (color [I], color [j]) & gt; 0)
{
Strcpy (b, color [I]);
Strcpy (color [I], color [j]);
Strcpy (color [j], b);
}
}
}
}

CodePudding user response:

Void fsort (char * color [], int n) parameters for the char pointer array
Void fsort (char color, int n) parameters for the char
  • Related