title: Cleanly access array of structures based on a value
body: <p>I'm trying to create an array of structures, where one entry is created for every device that joins in the network with the one that is running the program. This array should be accessed with the network address of the interested device.</p>
  
  <p>Example: there are three (other) devices on the network, with addresses 0x1, 0x2 and 0x3 (we're running on 0x0). Now we want to access the data structure related with device 0x1, which let's suppose is Table[0]. The problem is to associate the address (<code>0x1</code>) with the index (<code>0</code>).</p>
  
  <p>NOTE: the network addresses are dynamically assigned by other parts of the software and are <em>not</em>  under my control. They are also <em>not</em> guaranteed to be sequential.</p>
  
  <p>What is the cleanest way to do this?</p>
  
  <p>The most intuitive way to me is to search the whole table comparing the <code>Address</code> field of each entry with the specific address (in the example <code>0x1</code>), and then returning the index, but I was wondering if there is a more appropriate way to do this common operation. Which, by the way, probably has a proper name (dynamic data structure?).  </p>