title: idiomatic way to construct the complement of an array in C
body: <p>I'm writing a function that gets passed a pointer to an array of length 4. This array will contain integers <code>0 &lt;= x &lt;= 52</code> and I would like to construct an array of length 48 with every integer from da kine that's not in the passed in array. In python this would be</p>
  
  <pre><code># just included for specificity
  cards = [card for card in deck if card not in hand]
  </code></pre>
  
  <p>in C the best I can do is</p>
  
  <pre><code>int i, j, k, found_flag;
  int cards[48];    /* int hand[4] is passed in */
  
  k = 0;
  for (i = 0; i &lt; 52; i++) {
    found_flag = 0;
    for (j = 0; j &lt; 4; j++) {
      if (i == hand[j]) {
        found_flag = 1;
        break;
      }
    }
    if (!found_flag) {
        cards[k++] = i;
    }
  }
  </code></pre>
  
  <p>Is this optimal for this circumstance? Generally, is the 'go-to' pattern? </p>