[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: newbie C programming question
- From: Gordon Messmer <yinyang eburg com>
- To: redhat-list redhat com
- Subject: Re: newbie C programming question
- Date: Thu Jan 2 03:55:13 2003
On Thu, 2003-01-02 at 00:18, Christopher Henderson wrote:
> My first program, a simple "Hello World", is as follows
>
> #include < stdio.h>
>
> void main()
> {
> printf("\nHello World\n");
> }
>
> I go to a console and type gcc hello.c as stated in the tutorial and get
> the following error spit out at me -
>
> hello.c:1:20: stdio.h: No such file or directory
Remove the space before the header name.
> hello.c: In function `main':
> hello.c:4: warning: return type of `main' is not `int'
The C standard requires that the return type of the "main" function be
int, not void. Your main function should always be declared:
int main( int argc, char ** argv )
or, equivalently:
int main( int argc, char * argv[] )
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]