Unaware address problem if saving it in a struct

Hi, i have some problems saving the address of the sensors in a struct, if i directly get the address in the struct it compiles and uploads but behaves erratically (never exits the loop where it should put the address in the struct, and it crashes).
if i save the address in a temporary address object it says “invalid array assignment”

this is a part of the sketch

struct sensorstructure {
  DeviceAddress address;

struct datastructure {
  struct sensorstructure sensor[3];
  int totalNumberOfSensors;

datastructure data;
DeviceAddress tempAddress;


  for (y = 0; y < x; y++)
    data.sensor[y].address = tempAddress;

if i change it to this, it goes very bad…


I really can’t find why, sure i am missing something, can anyone help?

Post your full code please.

I got it...

I was declaring "struct sensorstructure sensor[3];" since i have 4 sensors i was thinking that creating 3 sub structures would gave me from 0 to 3 not 1 to 3, DOH!!!
It was hanging because i was writing an address in sensor[4] that was non existent.

Passing the address from the temp to the structure gives me the error but i don't need anymore to do it.