Hallo,
I want to get the address of array 'arr[]' and store its low and high part to dbgarr[2]. Is there a way how to do it?
IDE returns compile time error on macro highByte(), lowByte() on example below...
thx.
// file: print_address_test.ino
// how can I extract the address of array ?
//
const char arr[]= {'0','1','2','3'};
uint8_t dbgarr[2];
void setup() {
dbgarr[0] = highByte(&arr[0]); // <--fails
dbgarr[1] = lowByte(&arr[0]); // <--fails
}
void loop() {
}
// eof
In file included from print_address_test.ino:4:0:
print_address_test.ino: In function 'void setup()':
F:\programs_x86\arduino-1.6.5\hardware\arduino\avr\cores\arduino/Arduino.h:100:38: error: invalid operands of types 'const char*' and 'int' to binary 'operator&'
#define lowByte(w) ((uint8_t) ((w) & 0xff))
Why would anyone name a variable that is not a pointer "ptr"?
Just as a reminder, I suppose.
Same thing as with variable names like "led", "button", "relay" and so on: People choose mnemonic names while they know that a variable named "led", "button", "relay" are not a real led, button or relay. They just represent what the name stands for. Same with an int named "ptr".