extern char ** environ的定义在哪里? [英] where is the definition of extern char **environ?

查看:76
本文介绍了extern char ** environ的定义在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以像这样在C语言中获取环境变量:

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;
}

但是环境的定义在哪里?我在unistd.h中找不到.它是如何工作的?

but where is the defination of environ? I can't find that in unistd.h. and how does it work?

推荐答案

environ 在Glibc源文件

environ is defined as a global variable in the Glibc source file posix/environ.c.

这篇关于extern char ** environ的定义在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆