字符指针数组 - 查找关键字
#include <string.h>
int iskey(char *s)
{
static char *keyword[] = {
"auto", "_Bool", "break", "case", "char", "_Complex",
"const", "continue", "default", "restrict", "do", "double",
"else", "enum", "extern", "float", "for", "goto",
"if", "_Imaginary", "inline", "int", "long", "register",
"return", "short", "signed", "sizeof", "static", "struct",
"switch", "typedef", "union", "unsigned", "void", "volatile",
"while", NULL
};
int i;
for(i = 0; keyword[i] != NULL; i++) {
if(!strcmp(s, keyword[i]))
return 1;
}
return 0;
}