Changing Values of a Row in a 2D Array Using For Loops
<p>I have a function called <code>zero_row</code>. This function inserts the value of zero into all a row that is specified. The function takes to variables. <code>a</code> (the array) and <code>row</code> (the row in the array). Here is my function</p>

<pre><code>void zero_row (int a [4][5], int row){
    for (int i = 0; i &lt; 4; i++) {
        a[i][j] = 0;
    }
}
</code></pre>

<p>I know how to set values of the entire array to zero. As i have a function to do this as well.</p>

<pre><code>void zero_all (int a [4][5]) {
    for (int i = 0; i &lt; 4; i++) {
        for (int j = 0; j &lt; 5; j++) {
            my_arr[i][j] = 0;
        }
    }
}
</code></pre>

<p>I cant seem to figure out how to do this using the variable <code>row</code>. I want to use this variable so I can later change the row in my main function, like so: <code>zero_row(a, 3);</code>. Can anyone help?</p>

<p>Thanks!</p>