In order to get an environment variable in a C
program, one could use the following:
getenv()
extern char **environ;
But other than the above mentioned, is using char *envp[]
as a third argument to main()
to get the environment variables considered part of the standard?
#include <stdio.h>
int main(int argc, char *argv[], char *envp[])
{
while(*envp)
printf("%s\n",*envp++);
}
Is char *envp[]
portable?