题解 | 字符串反转
字符串反转
https://www.nowcoder.com/practice/e45e078701ab4e4cb49393ae30f1bb04
#include <stdio.h>
#include <string.h>
int main()
{
char str[1010] = {0};
fgets(str, sizeof(str), stdin);
for (int i = strcspn(str, "\n") - 1; i >= 0; i--)
{
printf("%c", str[i]);
}
printf("\n");
return 0;
}
查看6道真题和解析
