3.7 environ

The environ variable is a pointer to the strings in the process environment.

It is declared in the STDLIB.H include file as follows:

extern char *environ[ ];

The environ variable provides access to memory areas containing process-specific information.

The environ variable is an array of pointers to the strings that constitute the process environment. The environment consists of one or more entries of the form

NAME=string

where NAME is the name of an environment variable and string is the value of that variable. The string can be empty. The initial environment settings are taken from the operating-system environment at the time of program execution.

The getenv and _putenv routines use the environ variable to access and modify the environment table. When _putenv is called to add or delete environment settings, the environment table changes size; its location in memory may also change, depending on the program's memory requirements. The environ variable is adjusted in these cases and always points to the correct table location.