Seems like I still didn't get the pointers in C right.
I want the length of the global array (pointer) j being dynamic.
I have this (Arduino) code
unsigned int* j;
void setup() {
Serial.begin(9600);
initj();
Serial.println(j[0]); //111 -> right
Serial.println(j[0]); //768 -> wrong!
Serial.println(j[1]); //32771 -> wrong!
}
void initj() {
unsigned int i[2];
i[0] = 111;
i[1] = 222;
j = i;
Serial.println(j[0]); // 111 -> right
Serial.println(j[1]); // 222 -> right
}
void loop() {
}
How can I do this right?
Thank you in advance!