[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: [LI] C Programming problem



Rohit forced the electrons to say:
> > As an aside, standard C demands that main should always return an
> > int. Your program might crash if you declare main as void main().
> 
> Man, this I have observed as being used in countless programs on
> Tc++ [on PCs]

I said might - not will. :-)

The ANSI standard of C says main has to be one of (or equivalent variations):
int main(void)
int main(int argc, char **argv)

If your compiler supports void main(), then that should be considered as a
compiler specific extension, and shouldn't be used in programs that are meant
to be portable.

Refer to the comp.lang.c FAQ, available at http://www.faqs.org

Binand

-- 
#include <stdio.h>                                   | Binand Raj S.
char *p = "#include <stdio.h>%cchar *p = %c%s%c;     | This is a self-
int main(){printf(p,10,34,p,34,10);return 0;}%c";    | printing program.
int main(){printf(p,10,34,p,34,10);return 0;}        | Try it!!
--------------------------------------------------------------------
The Linux India Mailing List Archives are now available.  Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.