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 ?
9 Respostas
+ 14
i don't think there is any way to access that value
//at least here
+ 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? @@
+ 3
you simply cannot, when you using
system.out.println(54);
you declaring a new variable that you cannot access.
+ 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 ;)
+ 2
Que itself is wrong as the value directly printed is not saved anywhere so there is no question of printing the "stored" value..
+ 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 ^^
+ 2
In case of interpreter, I'm agree (if interpreter is written in that way), but in case of compiler, not :P
+ 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..
0
Well yeah it will be stored in registers lol..