Why do books say, “the compiler allocates space for variables in memory”?

前端 未结 7 1590
我在风中等你
我在风中等你 2020-12-31 10:54

Why do books say, \"the compiler allocates space for variables in memory\". Isn\'t it the executable which does that? I mean, for example, if I write the following program

7条回答
  •  长发绾君心
    2020-12-31 11:37

    When we hire an architect to design a house, he or she defines the size of the rooms, etc. and informs the workers (labourers) about it. The labourers do the work accordingly. But still we would say "The architect made the house this way" and not "The labourer made the house this way".

    The labourer is just performing the steps defined by the architect. The compiler actually does all the work for checking and defining how much memory is to be allocated, etc. at run time and then those instructions are just followed.

提交回复
热议问题