line 3: syntax error near unexpected token `('

Hi All
I've used UNIX in the past experimenting with commands through terminal but thats about it. Im now currently teaching myself "C".
Using a book from the library, the first chapter asks you run and compile your program from a command-line prompt. As you will see the program is very simple, please see below, but I am scratching my head as to why there is any problem with this when running this through UNIX. I coded the below with a textEdit and I am also using Xcode and it builds succesfully, but when I put it through UNIX I get the following

./hello.c: line 3: syntax error near unexpected token `('
./hello.c: line 3: `int main (void)'

I have searched your forums and Google and although there is much regarding the title, none covers something so simple as this one. I would very much appreciate if you could advice me what this is?

Many thanks for your time and reading,
Camzio

int main( int argc, char **argv)

Try this.

The code should work. Have you compiled your program?

First you have compile your program with:

cc hello.c -o hello

And the you can run it with:

./hello

Regards

Franklin -

Some wierd compilers expect two arguments to main. It also could be a shell error, like you think.

Many thanks to all those who replied, it actually worked by using, as advised cc hello.c -o hello and then running ./hello the book says to type gcc -g -o hello hello.c. Once again thank you.