delorie.com/archives/browse.cgi | search |
Message-Id: | <199812311409.OAA03793@remus.clara.net> |
From: | "Arthur" <arfa AT clara DOT net> |
To: | <djgpp AT delorie DOT com> |
Subject: | RE: Hello world isn't working :( |
Date: | Thu, 31 Dec 1998 14:08:25 -0000 |
X-Priority: | 3 (Normal) |
X-MSMail-Priority: | Normal |
X-Mailer: | Microsoft Outlook 8.5, Build 4.71.2173.0 |
Importance: | Normal |
In-Reply-To: | <003701be3455$c7004220$81f8c6c3@johans-dator> |
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3110.3 |
Reply-To: | djgpp AT delorie DOT com |
> >> My hello world doen't work :( how can this be?? > >> > >> #include > > > Delete that row! You should #include <stdio.h> (for printf) and #include <stdlib.h> (for exit) > >> > >> int main() > > > it should be main() or main(void) No, ANSI says that main() _should_ return an int. > >> { > >> printf("Hello world!\n"); > >> exit(0); > > > You don't need that one either. When it comes to the end of main, it exits > anyway Yeah, but main() should return an int, so you should really return one at the end of your program. I use return 0; instead of exit(0); because then you don't need to include stdlib.h. DJGPP doesn't require you to return anything at the end (it adds it if it's not there), but that doesn't mean that other compilers don't mind it. James Arthur - jaa AT arfa DOT clara DOT net http://www.jado.org/users/arfa/ ICQ#15054819
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |