BulgarianPride
Well-Known Member
Re: Learning to program in C
Damocles said:DiscoSteve said:#include<stdio.h>
main(int argc, char *argv[])
{
printf("Hello world\n");
}
Still got it!
#geekalert
try reading this
<a class="postlink" href="http://crasseux.com/books/ctutorial/index.html#Top" onclick="window.open(this.href);return false;">http://crasseux.com/books/ctutorial/index.html#Top</a>
That's a failure.
You didn't return an integer in main, and you didn't declare its type (it varies across different compiler implementation). You can probably get away without the return value as main implicitly returns 0 according to the standard, but you leave it in just in case.
The better way would be:
Code:#include <stdio.h> int main(void) { printf("Hello, World"); return 0; } quote] Also note the lag of a newline character and lack of arguments to main, these are not strictly required. The argc/argv convention is dependent on the platform that you are writing on.[/quote] Haha. Failed attempt on using [code] :)