-1

I tried the following code:

#include<stdio.h>

main()
{
    int i;
    for(i=1;i<50;i++){
    printf("Hello World");
    }
}

and

#include<stdio.h>

main()
{
    int i;
    while(1){
    printf("Hello World");
    }
}

codepad shows "Time out". Does it have syntax-checks or does it simply check if my program takes up too much time?

  • what do you mean by `how to do` ? – CharlesB Feb 15 '12 at 10:50
  • 1
    How to check infinite loop like codepad. – user1044942 Feb 15 '12 at 11:01
  • Without a `'\n'` in the output (or a explicit `fflush(stdout);`) the output may be "stuck" in a buffer and you never see it in the 2nd case. **WARNING: before the code times out, it may print several megabytes worth of "Hello World"s** – pmg Feb 15 '12 at 18:30

1 Answers1

2

It looks like codepad has limits for resources used by submitted programs, and stops the ones that are beyond them.

Your infinite loop program exceeds the time limit, and is stopped with "Time out" message. So there's nothing related to syntax checking here.

CharlesB
  • 86,532
  • 28
  • 194
  • 218