Using an Array to hold variable names

Looks to me like you are wanting to update the global value to a new value. BUT what you are actually doing is overwriting the address of the global data in the struct.

  1. You load the struct with an address of one of your globals.
  2. You want to update this global.. Try it this way.
*(OBDArray[Row].Data) = CAN_Receive(OBDArray[Row].PID);

This will update the gloabl int that Data is pointing to.

-jim lee

1 Like