[Login|Register]
New post

Show post

Search forum

Read topic
easy or not 2011-09-16 16:51:56 Red_Alert
以下代码运行很对,为什么总是runtime error呢
#include <stdio.h>
int main()
{
    char c[10000000];//保存字符的数组
    int i,j;//i为输入统计,j为输出标记
    for(i=0;(c[i]=getchar())!=EOF;i++);//输入失败则结束
    for(j=0;j<i;j++)
        putchar(c[j]);//输出
    return 0;
}
Re:easy or not 2011-11-23 02:08:34 tinybird
因为eof不是char型
Re:easy or not 2013-03-06 10:43:25 qq510975267
数组越界了,测试数据远比想象的大。应该是不能这样解
Reply
Title
Message
(64K)
University of Science and Technology of China
Online Judge for ACM/ICPC
Processed in 1.4ms with 1 query(s).