#include
// https://man7.org/linux/man-pages/man7/environ.7.html
extern char **environ;
int main(int argc, char **argv) {
// list out all the environment variables
for (int i=0; environ[i]!=NULL; i++) {
printf("%d: %s\n", i, envp[i]);
}
return 0;
}
xxxxxxxxxx
Extern keyword enables for declaring of global variables that are linked during compilation. When we make **environ; as a globally accessible variable. We save a pointer to the systems path variable.