| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | How do i learn `c` |
Hey Patrick,
> what is a char **argv ? as this is the first time
> i've seen this type of char **argv used ??
Fine! I'll explain in detail. The goodies passed to main() as argv are
actually just a list of null terminated strings usually representing the
additional words, letters, numbers or flags on the command line.
For example, the command line "find / *.doc -print", would
have "find" as argv[0], "/path/find" as argv[1],
"/" as argv[2], "*.doc" as argv[3], "-print"
as argv[4], and NULL as argv[5]. That would make argc 4.
There are two ordinary ways to refer to such a list. The first is char *argv[]
... an array of pointers to char. The second way is as char **argv ... a
pointer to a pointer to char. The pointer points to the first string in the
list. Incrementing the pointer, (++argv) makes it point to the second string
and so on, so it is really a convenient way to reference the command line
arguments one at a time.
The above is a little simplified for a beginner, and makes certain
assumptions. Do not let the forward slashes confuse you. If you are an
MS-Dos or Windows fan, then read them as backslashes (\).
I hope it helps.
Best wishes,
Bill.
---
* Origin: Meerkats Anonymous (2:2504/200)SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728 SEEN-BY: 639/252 670/213 218 @PATH: 2504/200 213 2503/501 252/356 140/1 270/101 396/1 633/260 635/506 728 @PATH: 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.