编程问题!~~~
来源:百度知道 编辑:UC知道 时间:2024/07/04 02:39:32
请编程程序,对键盘输入的字符。逆序后的字符串仍然保留在原来字符数组中不得调用任何字符串处理函数。例如:输入hello world输出dlrow olleh
#include <stdio.h>
int main()
{
char str[100];
int i, j, len;
i = j = len = 0;
fgets(str, 100, stdin);
while (str[i])
++i;
len = i;
--len;
i /= 2;
for (; j < i; ++j)
{
char temp = str[j];
str[j] = str[len-j];
str[len-j] = temp;
}
printf("%s\n", str);
return 0;
}
用什么语言?