Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×

Licheng's blog

By Licheng, 15 years ago, In English
#include <stdio.h>
int main()
{
printf("Hello codeforces!");
}
  • Vote: I like it
  • -18
  • Vote: I do not like it

| Write comment?
15 years ago, hide # |
 
Vote: I like it -8 Vote: I do not like it
may be adding return 0; would be good in future. All the best.
:)
  • 15 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it
    From Wikipedia:
    Within functions that define a non-void return type, failure to return a value before control reaches the end of the function results in undefined behaviour (compilers typically provide the means to issue a diagnostic in such a case).[17] The sole exception to this rule is the main function, which implicitly returns a value of zero.[18]
    • 15 years ago, hide # ^ |
      ← Rev. 2  
      Vote: I like it +3 Vote: I do not like it

      Hm... Wikipedia... Is it a new compiler?

      A lot of contestants during last 15 years have a lot of trouble because of omission of this ending return. Surely one could enjoy spending his time during contest and found out how present compiler reacts.

      But I suppose that such experiments are not real goal for contestants.

      There are specific compilers + library suits which does not even allow main to have "int" type (like Keil or WinAVR), but that means nothing.
      • 15 years ago, hide # ^ |
        ← Rev. 2  
        Vote: I like it +2 Vote: I do not like it

        Quote has a link to standard of language c++. It's a compiler's problem, if it doesn't follow standards.
        • 15 years ago, hide # ^ |
           
          Vote: I like it 0 Vote: I do not like it
          Compiler's problem would become contestant's problem if he want to rely upon some "standard" but obscure facts, without significant reason to do so. I believe that MSVC and G++ would work well, and none would use Borland. But I do not see what for we need to skip these few characters if it is altogether proper and meaningful that int function should return int value.
15 years ago, hide # |
 
Vote: I like it +1 Vote: I do not like it
Adding \n at the end of the message would also be a better practice I think...