C the same global variable defined in different files

前端 未结 6 955
我在风中等你
我在风中等你 2020-12-04 17:09

I am reading this code from here(in Chinese). There is one piece of code about testing global variable in C. The variable a has been defined in the file t

6条回答
  •  日久生厌
    2020-12-04 17:41

    a and b have the same addresses because they occur at the same points in the file. The fact that b is a different size doesn't matter where the variable begins. If you added a variable c between a and b in one of the files, the address of the bs would differ.

提交回复
热议问题