倒序字符串
Time Limit: 1000 ms
Memory Limit: 65536 KiB
Problem Description
下列程序实现的功能是将字符串逆序存放并输出。
请将下列程序补充完整,最后提交完整的源程序。。
#include <string.h>
#include <stdio.h>
void fun(char str1[])
{
int i=0,j;
char str2[80];
while(str1[i]!='\0')
{
str2[i]=str1[i];
i++;
}
for(j=0;j<i;j++)
;
}
main()
{
char str1[80];
printf("Enter Str1: \n");
gets(str1);
fun(str1);
printf("Result is: %s\n",str1);
}
Input
一个字符串。
Output
倒序后的字符串。
Sample Input
This Is a c Program
Sample Output
margorP c a sI sihT