Search code examples
c++language-agnosticprogramming-languages

Whether variable name in any programming language takes memory space


e.g.

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

and

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

out of (1) and (2) which will acquire more memory space or equal space would be aquire?


Solution

  • Both occupy the same amount of memory. Variable names are just to help you, the programmer, remember what the variable is for, and to help the compiler associate different uses of the same variable. With the exception of debugging symbols, they make no appearance in the compiled code.