+ 2

Will memory allocation happen if I simply use the value instead of storing them in a variable?

Assume I've a dictionary "dict" of type <string, int>, and a entry {"lol", length}. If i simply try get the value for lol by typing dict["lol"] without storing the value in a variable and using the variable name instead, will the memory be allocated for the string litral?

14th Jul 2018, 4:55 AM
Rusty.Metal
3 Antworten
+ 3
On the heap? Majstr Divya Sudagaran
14th Jul 2018, 11:57 AM
Rusty.Metal
+ 2
Yes it will.
14th Jul 2018, 7:50 AM
Majstr
+ 1
Yes.Memory will be allocated in Heap
14th Jul 2018, 5:20 PM
SagarReddy
SagarReddy - avatar