更改過後的程式,還是有錯誤~
出現這個錯誤:
In function `FindCompare':
35 'for' loop initial declaration used outside C99 mode
複製程式
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void FindCompare(void);
char string_save[10][50];
char find_string[100][50];
int find_count[100];
int main(void)
{
int a;
printf("輸入十個字串\n");
for(a=0;a<10;a++)
{
gets(string_save[a]);
}
FindCompare();
system("pause");
return 0;
}
void FindCompare(void)
{
int i, j, k, v;
for ( i = 0, v = 0; i < 10; i++ )
{
for ( j = 0, k = strlen(string_save[ i ]); j <= k; j++ )
if ( (string_save[ i ][ j ] ) == 32 || j == k )
{
string_save[i][j] = 0;
for ( int f = 0; f < 100; f++ )
if ( strlen(find_string[ f ]) == 0 )
{
strcpy(find_string[ f ], string_save[ i ] + v);
find_count[f]++;
break;
}
else if ( strcmp(find_string[ f ], string_save[ i ] + v) == 0 )
{
find_count[f]++;
break;
}
v = j + 1;
}
v = 0;
}
}