argv isn't really the "arguments" it's more like the entire command line. Thus, argv[0] is the first thing on the command line (the name you typed in to run it). As for the second question, I'm not really sure what you mean.
I see. Thanks. For the second question, I am referring to the first and last parameters in the main method: argc and envp[]. Where/by whome are these initialized? My guess is the OS, but I am not sure. For example, I am using argc to determine how many arguments are on the command line. How does it know?
Second, it's not really a question of how the shell counted the command line arguments but more of why. The argument count is really just the size length of the args array.
The argc is very handy, also stops you running into access violations if you try to access say argv[8] which doesn't exist. in this case would throw a stackdump.
I'm always checking to make sure that there's more arguments left than my current count, while still being able to parse almost infinite number of command line args. That way I don't try and access an element in argv[n] that doesn't exist.
Ahh I see. This makes a lot of sense. Thanks. What about the envp variable though? (Microsoft calls this an 'environment' variable), but I am not sure what relevance it holds. I checked out the link provided by moorecmm, and it is not listed as a 'standard' parameter.
Just ignore it.. it's non standard so there's no point using it unless you have been told to.
Being that you are using fedora it doesn't make much sense why you'd use a nonstandard, or something that would only compile on windows.