题解 | #数字颠倒#
数字颠倒
https://www.nowcoder.com/practice/ae809795fca34687a48b172186e3dafe
#include <stdio.h>
#include <stdlib.h>
int main() {
char *s;
s = malloc(100);
int i = 0;
while ((s[i++] = getchar()) != EOF) { // 注意 while 处理多个 case
// 64 位输出请用 printf("%lld") to
if(i >= 100)
s = realloc(s, i + 1);
}
for(int j = i - 3; j >= 0; j--)
{
printf("%c", s[j]);
}
return 0;
}
