I wonder what the abbreviation envp stands for, for example here:
int main(int argc, char **argv, char **envp);
I also wonder what the v in argv initially stood for. Was the v for "value"? Or maybe "vector"?
The meaning is:
argv stands for argument vectorargc for argument count, andenvp for environment pointer.We can discuss about the good or bad naming convention, but it's a historic usage that dates back to the beginning of the C language: B.W.Kernighan and D.Ritchie used already argc and argv for main() in their first edition of The C Programming language in 1978.
The envp was added later from the UNIX development and is an alternative for using the environ pointer. I found a reference to it in a book from 1986, but it's certainly even older. It doesn't need a count, because it's null terminated. Note that it is not portable and therefore the use of getenv() should be preferred.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With