-
Junior Member
static, global, local variable & volatile....
where are static, global, local variables stored in memory..... and how is volatile different from these.......
-
Expert Member
Re: static, global, local variable & volatile....
All local variables are stored in the stack frame of the Sub/Function in which they are defined. Therefore, the address of local variables may vary with each invocation of the Sub/Function in which they are defined (because they are created each time the Sub/Function is executed, and destroyed upon exit). It is unsafe to return a pointer to a local variable, since the storage for that variable is released when the Sub/Function ends.
Conversely, GLOBAL and STATIC variables are stored in the main data memory area, so their address stays constant for the duration of the program module, so returning a pointer to a GLOBAL or STATIC variable is quite safe.
-
Junior Member
Re: static, global, local variable & volatile....
In case of volatile variable ,memory addresses are always available in chache memory hence when we need fast execution of some variable , Volatile variable is very usefull .
-
Junior Member
Re: static, global, local variable & volatile....
what is the difference between java and javascript?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules