这段程序那里有错误!!!
#include "stdio.h"void main(void)
{
char *keywords[] = {"auto", "char", "double", "float", "int", "long", "short"};
char a[100], *b[100][100];
int x = 0, m = 0, c;
int out = 0, in = 1, state1, state2;
state1 = state2 = out;
while( (c = getchar()) != EOF)
{
if ( c == ';' || c == '(' || c == ' ')
state2 = out;
if (!(c >= 65 && c <= 90 || c >= 97 && c<= 122) && state1 == in && state2 == in)
{
strcpy(b[m][100], a);
m++;
}
if (!(c >= 65 && c <= 90 || c >= 97 && c<= 122))
{
state1 = out;
x = 0;
}
else
state1 = in;
if (state1 == in)
{
a[x] = c;
a[x + 1] = 0;
x++;
}
for(int i = 0; i < 7; i++)
if (strcmp(a, keywords[i]) == 0)
{
state2 = in;
state1 = out; //为了不把关键字当作标识符
}
}
}
===============================================================================================================
为什么
char a[100] ="fsadfdsa";就可以?
但是char b[100][100];
b[0][100] = "fdsafsad";就不行了?