What is the use of extern in declaring constants?
can please tell me what is the use of extern variable when declaring the constant variables in different file.
The extern keywords forces the compiler to treat the statement as a declaration rather than a definition. In other words, extern prevents the compiler from reserving space for the variable. Thus, only the compilation unit which does not use extern provides a definition, while the others merely use the declaration, which is in keeping with the "one definition rule"; if each compilation unit were to reserve space independently for the same variable, it would result in a violation of the "one definition rule". Note that extern literally means that "the definition is provided externally (by a different compilation unit)".
Just like C, extern keyword means that the symbol is defined in another object file that will be linked to this one in compilation phase.