任何编程语言中的变量名是否占用内存空间 [英] Whether variable name in any programming language takes memory space

查看:475
本文介绍了任何编程语言中的变量名是否占用内存空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

(1)和(2)将获得更多的内存空间或相等的空间吗?

解决方案

两者占用相同的内存量。变量名只是帮助你,程序员,记住变量是什么,并帮助编译器关联相同变量的不同用途。除了调试符号,它们在编译的代码中不出现。


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?

解决方案

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.

这篇关于任何编程语言中的变量名是否占用内存空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆