I got the following error:
warning: variable 'b' set but not used
.
I think I do a really small thing wrong but I can't figure out what it is.
#define array_size(array) ((int)(sizeof(array) / sizeof((array)[0])))
typedef struct Boid {
unsigned long start_animate_time;
} Boid;
Boid boids[4];
Boid create_boid() {
unsigned long start_animate_time = 0L;
Boid b = {start_animate_time};
return b;
}
void setup() {
Serial.begin(9600);
boids[0] = create_boid();
boids[1] = create_boid();
boids[2] = create_boid();
boids[3] = create_boid();
for (int i = 0; i < array_size(boids); i++) {
Boid b = boids[i]; // <<<<<<<<<<<<< this line!
b.start_animate_time = 456;
}
for (int i = 0; i < array_size(boids); i++) {
Boid b = boids[i];
Serial.println(b.start_animate_time); // BUG always 0
}
}
void loop() {
}
flock_01_ino_debug.ino:28:10: warning: variable 'b' set but not used [-Wunused-but-set-variable] Boid b = boids[i]; ^
Symbol 'I' could not be resolved
. ChangeI
toi
.// <<<<<<<<<<<<< this line!
Since that is the only thing I added in the browser.