[ssug-malappuram] Re: [MES-FSUG] How do variables in different programming languages work?

  • From: raghesh <raghesh.a@xxxxxxxxx>
  • To: ssug-malappuram@xxxxxxxxxxxxx
  • Date: Sat, 17 Sep 2011 23:20:12 +0530

On Thu, Sep 15, 2011 at 11:08 PM, Ershad K <ershad92@xxxxxxxxx> wrote:
> Hi,
>
>        I've a small query, how do variables work? I mean, a variable stores
> reference of a memory location which varies whenever the program is
> executed. How's this linking between variable_name-and-reference done?
> Some kind of replace/macro? Will it take another memory space to store a
> information that links a variable name and the address it stores?
>

All memory accesses are done with a "base + index" calculation. There
is a data segment for each program to store the variables. The index
will be same for a variable for the lifetime, but the base is varied
at link time. I hope this answers your query. For more details refer
concepts like Segmentation, Paging, Virtual memory etc.


> The questions might be foolish,
How can this be a foolish question? We teachers need such questions
from our students.

but I would like to know this process is
> carried out by computers :)
> --
> Sincerely,
> Ershad K
> http://ershadk.wordpress.com
>
> --
> You received this message because you are subscribed to the "MES-FSUG" group.
> To post to this group, send email to mes-fsug@xxxxxxxxxxxxxxxx
> To unsubscribe from this group, send email to 
> mes-fsug-unsubscribe@xxxxxxxxxxxxxxxx
> For more options, visit this group at 
> http://groups.google.com/group/mes-fsug?hl=en
>
> Our IRC channel #mes-fsug at irc.freenode.net. Webpage for GNULabs @ MESCE is 
> at http://gnulabs.org/mesce/
> Wiki: http://www.fosscommunity.in/wiki/Malappuram
>
>
>



-- 
Raghesh
Wiki: http://www.fosscommunity.in/wiki/Malappuram


Other related posts: