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

Re: Simple c program won't compile



On Mon, 05 Mar 2001, Juan Fuentes wrote:
> * Mark Phillips (mark@infoeng.flinders.edu.au) wrote:
>> 
>> int main(int argv, char **argc){
> 
> Mark you need to link to math library:
> 
> gcc -g thick.c -lm -o thick

This is (of course) correct.

> And main should be:
> 
> int main(int argc, char **argv);

This is not. (Using "should" in the sense that it must be this way to
compile, not be this way to be stylistically correct).  It is just
confusing to everyone else who reads his program to have it the way
that Mark has it.  Traditionally, argc stands for something like
"arguments count" and argv stands for something like "arguments
vector".  But they are just arguments to a function and can have any
name a person wants.  So all the following are correct:

int main(void)
int main(int foo, char **bar)
int main(int foo, char **bar, char **baz)

Cheers,
Chris

-- 
Got jag?  http://www.tribsoft.com



Reply to: