title: How to find which value is closest to a number in C?
body: <p>I have the following code in C:</p>
  
  <pre><code>#define CONST 1200
  int a = 900;
  int b = 1050;
  int c = 1400;
  
  if (A_CLOSEST_TO_CONST) {
    // do something
  }
  </code></pre>
  
  <p>What is a convenient way to check whether if a is the closest value to CONST among a,b and c ?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>It doesn't matter if I have 3 variables or an array like this (it could be more than 3 elements):</p>
  
  <pre><code>int values[3] = {900, 1050, 1400};
  </code></pre>