Reading byte array into float (expanding on SerialCallResponse example)

IMO, most of this confusion arises b/c we’re taught to associate a variable to its data content as if they were the same thing.

When we declare a variable, we’re just reserving a tiny contiguous block of memory addresses (bytes), which in most languages they vary from 1 to 8 bytes.

The variable itself is merely a label for the 1st memory address of that memory block.

In Java, only the content of a variable’s memory block can be passed around to other variables or to function calls.

We can’t pass the memory address of the variable itself!

In some system languages like C, they have an & unary operator, which forces a variable spit out its memory address instead of the value its memory address block stores.

So we need to mentally separate the variable from its content if we really wanna understand how things work internally.

1 Like