题解 | #句子逆序#
句子逆序
https://www.nowcoder.com/practice/48b3cb4e3c694d9da5526e6255bb73c3
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char *sp[1000];
char s[1000];
int i = 0;
while(scanf("%s",s) != EOF)
{
int l = strlen(s);
sp[i] = malloc(sizeof(char)*l);
memcpy(sp[i], s, sizeof(char)*l);
memset(s, 0, sizeof(char)*l);
i++;
}
while(i--)
{
printf("%s ",sp[i]);
}
return 0;
}

