Re: What does "*" mean in "int main(int argc, char *argv[])"?
From: Tom (tvaus_at_sympatico.ca)
Date: 02/13/05
- Next message: Tom: "Re: Answer needed"
- Previous message: Ulrich Eckhardt: "Re: NULL"
- In reply to: JoeC: "Re: What does "*" mean in "int main(int argc, char *argv[])"?"
- Next in thread: B. v Ingen Schenau: "Re: What does "*" mean in "int main(int argc, char *argv[])"?"
- Reply: B. v Ingen Schenau: "Re: What does "*" mean in "int main(int argc, char *argv[])"?"
- Reply: Francis Glassborow: "Re: What does "*" mean in "int main(int argc, char *argv[])"?"
- Reply: Barry Schwarz: "Re: What does "*" mean in "int main(int argc, char *argv[])"?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 13 Feb 2005 06:01:43 -0500
argc - is the number of parameters in the command line including
the program name.
argv[] - is the array of parameters passed in the command line.
As JoeC said, it is a pointer to an array of type char.
You can use argc in a for loop to process the argv[] values.
The int main simply means that the program will return an int after
execution. Using 'void main . . .' will work as well, you just don't
have to return a value. (not good if you want to use your program
in a batch file and need to check the error level for taking care of
the problem the program encountered)
Tom.
"JoeC" <enki034@yahoo.com> wrote in message
news:1108189249.089913.46440@z14g2000cwz.googlegroups.com...
> Sorry,
>
> the * means pointer. That ponts to first character in each word that
> you enter from the cmd line.
>
> For example you could write a porgram Hello.
>
> You can run the program with Hello Bob and it will take that value and
> display it in your porgam.
>
- Next message: Tom: "Re: Answer needed"
- Previous message: Ulrich Eckhardt: "Re: NULL"
- In reply to: JoeC: "Re: What does "*" mean in "int main(int argc, char *argv[])"?"
- Next in thread: B. v Ingen Schenau: "Re: What does "*" mean in "int main(int argc, char *argv[])"?"
- Reply: B. v Ingen Schenau: "Re: What does "*" mean in "int main(int argc, char *argv[])"?"
- Reply: Francis Glassborow: "Re: What does "*" mean in "int main(int argc, char *argv[])"?"
- Reply: Barry Schwarz: "Re: What does "*" mean in "int main(int argc, char *argv[])"?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|