newbee question about variables
avionikeren
Posts: 64
When I define variables this way I got troubles with the variables affecting each other
But the other way works fine:
What if I need more variables with many bytes?·
Variable1 byte[noparse][[/noparse]9] variable2 byte
But the other way works fine:
Variable2 byte variable1 byte[noparse][[/noparse]9]
What if I need more variables with many bytes?·
Comments
variable1[noparse][[/noparse]9]
somewhere. But the index of variable1 is only working inside the assigned RAM from index 0 to 8.
Do you mean I can not have more than 8 bytes in a variable?
No. If you define a variable as
byte fred[noparse][[/noparse] 6 ]
Then you can use fred[noparse][[/noparse] 0 ] through fred[noparse][[/noparse] 5 ].
If you use fred[noparse][[/noparse] 6 ] it will trample over whatever comes after fred.
The definition is the number of bytes to reserve, but the usage is 0 based.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life may be "too short", but it's the longest thing we ever do.