How to set all the elements of array to 0, after initialization or 2nd time in a loop?
<p>I am stuck with basics of an array. I googled it, but I could not able to solve this. This question  is concept oriented, but I am not able to bridge a gap. Please help me out resolve this.</p>

<p>I am very clear on initializing array for the first time, but not able to clear the array for next time :-( :-(</p>

<pre><code>int myArray[10] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }; // All elements of myArray are 5
int myArray[10] = { 0 };    // Will initialize all elements to 0
int myArray[10] = { 5 };    // Will initialize myArray[0] to 5 and other elements to 0
static int myArray[10]; // Will initialize all elements to 0

int myArray[10];// This will declare and define (allocate memory) but won’t initialize
int i;  // Loop variable
for (i = 0; i &lt; 10; ++i) // Using for loop we are initializing
{
    myArray[i] = 5;
}
</code></pre>

<p><strong>Problem statement:</strong></p>

<p>I am using a Global array which is of size 10000. I have 1k iteration loop, where I have to set the array to 'Zero' or predefined value i.e., 5 for each iteration.</p>

<p>I am doing this at the end of interaction like this:</p>

<pre><code>myArray[10000] = { 0 };
</code></pre>

<p>Its giving error while compiling in GCC compiler.</p>

<pre><code>error: [11707] syntax error before '{' token
</code></pre>

<p>Please help me out resolve this. </p>

<p>Thanks in advance.</p>