[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Hello World doesn't work



On Sat, Nov 28, 1998 at 09:03:39AM +0100, Ole J. Tetlie wrote:
> It can also be 'int main(void)', which is equivalent to 'main()'.

Hmmm. I was told that 'int func(void)' means it takes no parameters,
while 'int func()' means it could take any.

Some example source is below. gcc complains about the call to test2
(too many arguments) but not to test1.


#include <stdio.h>

int test1()
{
    printf("test1\n");
    return 0;
}

int test2(void)
{
    printf("test2\n");
    return 0;
}

int main(void)
{
    int i = 3;

    test1(i);
    test2(i);

    return 0;
}


Hamish
-- 
Hamish Moffatt VK3TYD              hamish@debian.org, hamish@rising.com.au
Latest Debian packages at ftp://ftp.rising.com.au/pub/hamish. PGP#EFA6B9D5
CCs of replies from mailing lists are welcome.   http://hamish.home.ml.org


Reply to: