Below is the general syntax for environ. Is char **environ a pointor to a pointor?? I am sure it means something else... please explain..
Code:#include <stdlib.h>
extern char **environ;
Printable View
Below is the general syntax for environ. Is char **environ a pointor to a pointor?? I am sure it means something else... please explain..
Code:#include <stdlib.h>
extern char **environ;
Nope, that's exactly what it is. A pointer to a pointer to a char.
Although it is interpreted as a pointer to an array of pointers, each of which points to a C-style string.
Yes it is.
Use it like you would the char **argv that main() receives.
It is a pointer to an array of char pointers. In other words, an array of strings where environ[0] is the first, environ[1] is the second, etc. It is exactly like argv but lists the environment variables instead of the command line arguments.
I would suggest against accessing it directly. You should go through getenv() instead.
Thank you all for your replies!! I really appreciate