69,382
社区成员
发帖
与我相关
我的任务
分享
#include "stdafx.h"
char* getLine() {
int c;
char a[20];
int index=0;
while ((c = getchar())!='\n') {
a[index++] = c;
}
a[index] = '\0';
return a;
}
int main()
{
printf("%s", getLine());
while (true) {}
return 0;
}
#include<stdio.h>
#include<stdlib.h>
char* getLine() {
int c;
char *a = (char *)malloc(20);
int index = 0;
while ((c = getchar()) != '\n') {
a[index++] = c;
}
a[index] = '\0';
return a;
}
int main()
{
printf("%s", getLine());
while (true) {}
return 0;
}