Using extern with the same parameter name inside a function

I have this c code having a global variable

main_prog.c

PLD po;
int main(){}

i has this function in the definition

functiondef.c

void function(PLD po)
{
  extern po;
}

what is my problem is that how does the compiler know that it uses extern po or the po parameter ??

+4
source share
1 answer

You can definitely access an external variable if you declare it in a different scope.

void function(PLD po)
{

    {
        extern PLD po;    //this is the po declared in main
    }
}
+2
source

Source: https://habr.com/ru/post/1533257/


All Articles