I ran into a function like this earlier:
int main(int argc, char **argv, char **argw){ } Why is there a need for three arguments, and how does this actually work?
The third argument to main is normally called envp.
int main(int argc, char **argv, char **envp) { Many compilers provide a third argument to main, but it is not specified in the C standard, so using it is undefined behaviour. If you try to port the code to a platform that doesn't provide a third parameter the program will most likely fail.
getenv function, though that requires knowing the name of the variable you want to refer to. In addition, POSIX specifies extern char **environ; (which for some reason isn't declared in any header).I've seen these arguments before. My compiler places them there as well when starting in C++ code. I can tell you for a fact that they are not necessary in C++, although I can't say for sure in C. They look to be slots for a variables to be passed in to the function int main. One of type int, and two of type char. These variables would be passed in, generally by the user at the time the program is executed.
char**, not char.char (variable name), where the ** is part of the variable name. Although, that is odd as it violates the rules of naming variables, unless the compiler sees the * as a 'wildcard'.char **argv is meant to suggest that **argv is of type char; it follows from that that argv is of type char**. The variable name is just argv; ** isn't part of the variable name, it's part of the declaration syntax.int main(void) and int main(int argc, char *argv[]). In C++, the first form is int main(). Equivalent forms may also be used; for example, as a parameter definition, char *argv[] is equivalent to char **argv. Implementations may, but need not, support other forms.
apple, which I cover in my answer linked above.