Your program is overly complicated and wrong.
You probably want this:
void naopak(char slovo[20])
{
int i;
for (i = 0; slovo[i] != ''; i++); // goto end of string
for (i -= 1; i >= 0; i--) // i -= 1 decrements i, because i points the NUL terminator
{
printf("%c", slovo[i]);
}
}
int main()
{
char slova[20];
scanf("%19s", slova); // input of word (%19s prevents buffer overflow
// if you enter more than 19 chars
naopak(slova); // print the word in reverse
return 0;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…