+ 1
(Ruby) Why size = 8?
So I made an array, I understand the reason of some of the sizes, except those which output 8 Here is the code. https://code.sololearn.com/cQ50F1U3tm3B/?ref=app
2 Answers
+ 1
tab[0], tab[1] and tab[2] contain variables of the class Integer.
Integer has a method called size which according to the documentation:
"Returns the number of bytes in the machine representation of int (machine dependent)."
0
So they are returning the size of type int, as they are a single integer? It makes sense. Thank you.