Whether variable name in any programming language takes memory space

后端 未结 10 1601
时光说笑
时光说笑 2021-01-05 17:44

e.g.

int a=3;//-----------------------(1)

and

int a_long_variable_name_used_instead_of_small_one=3;//-------------(2)
         


        
10条回答
  •  情深已故
    2021-01-05 18:02

    If my understanding is correct, they'll take up the same amount of memory. I believe (and am ready to get shot down in flames) that in C++ the names are symbolic to help the user and the compiler will just create a block of memory sufficient to hold the type you're declaring, in this case an int. So, they should both occupy the same memory size, ie, the memory required to hold an address.

提交回复
热议问题