#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 1000
int main(void)
{
char str[N], ch;
int i = 0;
int string(char str[N]);
while(1)
{
ch = getchar();
while(ch != EOF)
{
str[i] = ch;
i ++;
ch = getchar();
if(ch == '\n')
break;
}
if(ch == EOF)
break;
else
string(str);
i = 0;
}
return 0;
}
int string(char str[N])
{
int i, length ,word = 0;
length = strlen(str);
for(i = 0;i < length;i ++)
{
if(str[5] == '-'&&word == 0)
{
printf("I am showing help.\n");
word = 1;
}
else if(str[5] == 's')
{
if((strcmp(&str[i], "-") == 0)&&(strcmp(&str[i+1], "E") == 0)&&word == 0)
{
printf("I am a c99 preprocessor. I start from \"hello.c\" and end with \"foobar.c\".\n");
word = 1;
}
}
}
return 0;
}
我想问一下!为什么红色部分的总也不执行啊?
该学习了。。。