2021-06-23 06:00 AM
hello dear forum
accidentally i define same global variable in two different c file
why I havent got any error
thank you
2021-06-23 12:40 PM
C files are their own compilation unit. Other C files cannot see variables in them unless they are defined in a header (as extern, in this case).
Edit: above only applies if they're declared static.
2021-06-24 03:31 AM
An the linkers have different behaviour:
some allocates a variable for each source file, others only allocates one...