69,378
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
int main(void)
{
char *p;
p=(char *)malloc(sizeof(char));
int count=1;
while((p[count-1]=getchar())!=EOF&&p[count-1]!='\n')
p=(char *)realloc(p,++count);
puts(p);
return 0;
}