title: How to write more efficient code
body: <p>Question of the century? I basically want to know which would be more efficient if I wrote this code as several different variables or if I used small arrays.</p>
  
  <pre><code>int x = 34;
  int y = 28;
  int z = 293;
  </code></pre>
  
  <p>vs</p>
  
  <pre><code>double coordinate[3] = {34, 28, 293};
  </code></pre>
  
  <p>I have a coordinate struct which I will use in the following way:</p>
  
  <pre><code>typedef struct coordinates_t {
      double x = 0.0;
      double y = 0.0;
      double z = 0.0;
  
  } coordinates;
  
  
  typedef struct car_t {
      coordinates start; // car starting point
      coordinates location; // car current Location
      coordinates targCarVector; // Vector to car from target
      coordinates altitude; // Altitude of car
      coordinates distance; // Distance from car start to current position
  } car;
  </code></pre>
  
  <p>I'll need to do things like:</p>
  
  <pre><code>distance = car1.location - car1.start;
  </code></pre>
  
  <p>If I don't use an array I'll have to have a lot of lines of code, but if I use an array I'll have to use loops. Are arrays and loops more memory/cpu intensive? I am basically trying to see which is the most efficient way of writing this code.</p>
  
  <p>Thanks,
  DemiSheep</p>