/*6.编写一个程序把一个单词读入一个字符数组,然后反向打印出这个词。提示:使用 strlen()(第 4 章)计算数组中最后一个字符的索引。*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char word[20];
int i;
printf("Please input a word:");
scanf("%s", word);
for(i = strlen(word) - 1; i >= 0; i--)
printf("%c", word[i]);
printf("\n");
system("pause");
return 0;
}
C Primer Plus6-6
最新推荐文章于 2024-09-16 20:34:48 发布