we can get the environment variable in C like this:
extern char **environ;
int main(int argc, char *argv[])
{
int count = 0;
printf("\n");
while(environ[count] != NULL)
{
printf("[%s] :: ", environ[count]);
count++;
}
return 0;
}
but where is the defination of environ? I can’t find that in unistd.h. and how does it work?
environis defined as a global variable in the Glibc source fileposix/environ.c.