If variable values and references are stored in stack and heap memory where are variable names stored in a program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 21

If variable values and references are stored in stack and heap memory where are variable names stored in a program?

Also where are class/template definitions stored? Data storage memory? Are these locations different between compiled and interpreted languages?

6th Nov 2018, 9:39 PM
Sonic
Sonic - avatar
9 Answers
+ 14
Jay Matthews does that also apply to class definitions?
6th Nov 2018, 10:15 PM
Sonic
Sonic - avatar
+ 14
Also do interpreted languages use stack and heap memory similar to compiled languages?
6th Nov 2018, 10:16 PM
Sonic
Sonic - avatar
+ 6
Though this isn't like using a GUI, here's one way to poke around yourself using gdb (the GNU debugger)... Compiling this program: #include <stdio.h> int SoloLearn = 42; int main() { printf("%d", SoloLearn); return 0; } Compile and separate debug symbols: $ gcc -g -o solotest solotest.c $ objcopy --only-keep-debug solotest solotest.debug Start looking around... $ gdb (gdb) file solotest Reading symbols from solotest...done. (gdb) info variables All defined variables: File solotest.c int SoloLearn; (gdb) info addr SoloLearn Symbol "SoloLearn" is static storage at address 0x11028 (gdb) info symbol 0x11028 SoloLearn in section .data
7th Nov 2018, 1:03 AM
Kirk Schafer
Kirk Schafer - avatar
+ 6
variable name is not stored anywhere...it is just for for ease of programmer and for good readability of the code...when the code is converted into machine language, there is no variable name left in the code...
7th Nov 2018, 2:35 PM
Suhel Mulla
Suhel Mulla - avatar
+ 5
I don't know but the question begs clarification. Why is it being asked? Anyone who worked with low-level language will think twice before responding.
7th Nov 2018, 4:38 AM
Da2
Da2 - avatar
+ 5
With high-level languages, interpreters take care of all of that. During execution of the compiled programs, it's the operating system.
7th Nov 2018, 4:50 AM
Da2
Da2 - avatar
+ 3
Any 'low-level language' programmer understand that tags, such as variable and function labels are only the high level layer of the code. Once it's interpreted or compiled, it's all 0 or 1. It's all up to the operating system (linux, Microsoft, Android or Ios) to work on it
10th Nov 2018, 2:25 PM
Da2
Da2 - avatar
+ 1
how can I apply and do projects by html ,CSS and js ?
7th Nov 2018, 9:11 PM
Mahmoud Shawky
Mahmoud Shawky - avatar
0
bad work
10th Nov 2018, 2:14 PM
Fredrick