#include <stdio.h>
#include <string.h>
#define max_word 20
void pluralize (char word[]);
int main (void)
{
char noun[max_word]; /* stores temporary word entered by user */
printf("Enter a noun in singular form: ");
scanf("%s", noun);
while (strcmp(noun, "done") != 0)
{
pluralize (noun);
printf("The plural form is %s\n", noun);
}
}
void pluralize (char word[])
{
int length;
char noun;
length=1;
length = strlen(word);
for (;;)
{
printf("Enter a noun in singular form: ");
scanf("%s", noun);
if ((strcmp( noun, "done") == 0))
break;
pluralize (noun);
printf("The plural form is %s\n", noun);
}
return;
}
答案 0 :(得分:0)
在复数函数中,名词是一个字符,它表示一个字符。你想要一个像你主要的char数组:
char noun[max_word];
编译时没有错误。