"{" problem!


I everyone,

I just started to ready the book, and I have often the same problem.
I have and error at the first { I put. The error message said "expected identifier or ‘(’.

I check and recheck and everything it is the way it should be. (i think)
this is what i fund for the challenge 6 and where I have the problem.

#include <stdio.h>
#include <stdlib.h>

int main(int argc, const char * argv[]);
{ this is the one where I have an error message
int number = 5;
int squaredNumber = number*number;

printf ("\"%d\", squared is \"%d\".|n",number, squaredNumber);



There is a superfluous semicolon after the function’s argument list, which is offending the parser in the given context:

int main (int argc, const char * argv[]); <-- Look, it's here

Remove that semicolon:

int main (int argc, const char * argv[])

If you put a semicolon after a function’s argument list, you are stating that your are only declaring that function.

Declare FooBar:

int FooBar (int foo, double bar);

int FooBar (int, double);  // This is the same

If, however, you put a left brace instead, you are stating that you are both declaring and are about to define the function. Defining a function means providing its guts, that is, its body (code).

Both declare and define FooBar:

int FooBar (int foo, double bar)
   return foo / bar;

Just declaring a function does only half the job, but nevertheless it does a useful job. Declaring a function indicates that you know the name of the function, what kind of arguments it takes, and what kind of value it returns. This will have a soothing effect on the compiler. If you don’t declare a function before using it, the compiler will and should at least complain.

[If you want to become a competent programmer, contact pretty-function: pretty-function.org]