Setting all array elements to an integer
<p>I have an array,</p>

<p><code>int a[size];</code></p>

<p>I want to set all the array elements to <code>1</code></p>

<p>because some of the indexes in the array are already set to <code>1</code> so would it better checking each element using a conditional statement like,</p>

<pre><code>for (int index = 0; index &lt; size; index++)
{
    if (a[index] != 1)
      a[index] = 1;
}
</code></pre>

<p>or set all the indexes no matter what. what would be the difference?</p>
