oggplay 发表于 2014-6-26 21:47:44

【娱乐精神】请在两分钟之内发现此程序BUG!!!

反正我的内核是崩溃了,还好有保护机制:lol:
#include <stdio.h>

char *gets(char *s) {
int c;
char *dest=s;
int gochar=0;
while((c=getchar())!='\n' && c !=EOF) {
      *dest++=c;
      gochar=1;
    }
*dest++='\0';
if(c==EOF && !getchar)
      return NULL;
return s;
}

void echo() {
char buf;
gets(buf);
puts(buf);
}

//int main () {
// echo();
// return 0;
//}
[\b]


有只小稚飞不起 发表于 2014-7-20 17:09:33

无聊,用scanf("%10s"); 这样不就崩溃不了了
页: [1]
查看完整版本: 【娱乐精神】请在两分钟之内发现此程序BUG!!!