0

If i dont use variable to store the value rather i just print it ..later how can i access that value ???..without using variable

how to access stored value without variable ?

14th Jan 2018, 9:46 AM
Yaseen Shariff
Yaseen Shariff - avatar
9 Answers
+ 14
i don't think there is any way to access that value //at least here
14th Jan 2018, 10:25 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 4
You cannot avoid use of variable to store a value: if you can create a value without keeping track of where you create it (as you necessarly create it somewhere, even if it is in cpu registery), you cannot access it later. The case of registery are just special memory located at cpu level... but they are like limited fixed location variables to handle values picked in rest of computer memory (ram, rom, hdd, whatever else). So, even when you code without using variable, only with "not stored" values, they are temporary stored and accessed as variable, but without having the visibility on them ;P Anyway, I have difficulty to imagine wich could be the reason to avoid use of variable? @@
14th Jan 2018, 11:25 AM
visph
visph - avatar
+ 3
you simply cannot, when you using system.out.println(54); you declaring a new variable that you cannot access.
14th Jan 2018, 9:50 AM
Cain Eviatar
Cain Eviatar - avatar
+ 3
@DAVE: :D That's not false, semantically, but if he print a value not previously stored, I supposed he have generated it, and technically, a value was temporary stored somewhere but becomes unreachable ;)
15th Jan 2018, 5:05 PM
visph
visph - avatar
+ 2
Que itself is wrong as the value directly printed is not saved anywhere so there is no question of printing the "stored" value..
15th Jan 2018, 5:01 PM
DAVE
DAVE - avatar
+ 2
... and always technically, even a literal value will be stored somewhere in memory, either at compiling or interpreting time: in your example, 3 and 4 are necessarly stored somewhere in memory, but cannot be reached from another point of the code ^^
15th Jan 2018, 5:13 PM
visph
visph - avatar
+ 2
In case of interpreter, I'm agree (if interpreter is written in that way), but in case of compiler, not :P
15th Jan 2018, 5:16 PM
visph
visph - avatar
+ 1
Yup correct as u mentioned value may have been generated or maybe he jst printed it directly so it was not stored anywhere jst displayed for eg. cout<<3+4; The answer 7 will directly be displayed but not stored anywhere as ALU jst calculated nd printed the ans..
15th Jan 2018, 5:09 PM
DAVE
DAVE - avatar
0
Well yeah it will be stored in registers lol..
15th Jan 2018, 5:14 PM
DAVE
DAVE - avatar