Re: C


Subject: Re: C
From: Mike LeBlanc (leblanc@skycomputers.COM)
Date: Thu Jan 17 2002 - 06:04:01 MST


If you don't specify a return type, C assumes int. And () means
zero or more parameters of any type. Your main's are not the
same. If a function's return type is not void, most "modern"
compilers will yell at you if there's no return. Example #2
returns some garbage value. I don't know if it's "standard",
but I write main functions as

        #include <stdio.h>
        #include <stdlib.h> /* for exit() */

        void main() {
            printf("whatever\n");
            exit(0);
            }

david wright wrote:
>
> # include <stdio.h>
>
> int main (void)
> {
> printf ("whatever\n");
> return 0;
> }
>
> --------------------- example #2
>
> # include <stdio.h>
>
> main(){
> printf ("whatever\n");
> }



This archive was generated by hypermail 2a24 : Thu Jan 17 2002 - 06:13:17 MST