float misc = conv(&storedArrayName); //where 0 is the first position of the 8 bytes
This reads 8 bytes...
No. Nothing is "read" or moved around. Arrays are always passed "by reference" (another way of saying "by pointer"). The code you posted above and this...
float misc = conv( storedArrayName );
...produce the same result. As does this...
float misc = conv( & storedArrayName );
I prefer the first version because I think it makes it clear that a pointer to the first element of the array is being passed.
and returns a float value to variable "misc" ?
I'm not seeing where the array dn is initialized. Or does the "dn" mean something else?dn
does not have any special meaning. It is a simple parameter. When the conv
function is called, dn
becomes a pointer that points to the first byte in the storedArrayName
It's kind of like an alias. Outside of the conv
function, the section of memory is called storedArrayName
. Inside of the conv
function, the same section of memory is called dn
In C(++), arrays and pointers are essentially interchangeable. dn
all result in the first byte of the storedArrayName
all result in the second byte of the storedArrayName
Whoever wrote conv really should have prototyped the function like this...
float conv(byte dn)
...to make it quite clear that an array of eight bytes is expected.