更改过后的程式,还是有错误~
出现这个错误:
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;
}
}