Is it possible to declare multiple static variables with same name in a single C file?

A function-local static variable is something different than a global static variable.
Since there can be as many function-local statics with the same name as you like (provided they are all in different scopes), the compiler might have to change their names internally (incorporating the function’s name or the line number or whatever), so that the linker can tell them apart.

Leave a Comment