在函数内使用具有相同参数名称的extern

时间:2014-03-25 00:50:16

标签: c extern

我有这个具有全局变量的c代码

main_prog.c

PLD po;
int main(){}

我在定义中有这个功能

functiondef.c

void function(PLD po)
{
  extern po;
}

我的问题是编译器如何知道它正在使用extern po或参数po ??

1 个答案:

答案 0 :(得分:2)

如果在不同的范围内声明,可以访问extern变量。

void function(PLD po)
{

    {
        extern PLD po;    //this is the po declared in main
    }
}
相关问题