For example you can do it the following way
for ( size_t i = 0; i < 3; i++ )
{
a[1][i] = 0;
a[i][1] = 0;
}
For i
equal to 1
a[1][1]
will be set to zero twice. However it is unimportant. If you want you can use the if statement for this case.
For example
for ( size_t i = 0; i < 3; i++ )
{
a[1][i] = 0;
if ( i != 1 ) a[i][1] = 0;
}
Here is a demonstrative program
#include <stdio.h>
#define N1 3
int main( void )
{
int a[N1][N1] =
{
{ 3, 2, 5 },
{ 6, 4, 2 },
{ 1, 61, 45 }
};
for ( size_t i = 0; i < N1; i++ )
{
for ( size_t j = 0; j < N1; j++ ) printf( "%2d ", a[i][j] );
printf( "\n" );
}
size_t row = 1;
size_t col = 1;
for ( size_t i = 0; i < N1; i++ )
{
a[row][i] = 0;
a[i][col] = 0;
}
printf( "\n" );
for ( size_t i = 0; i < N1; i++ )
{
for ( size_t j = 0; j < N1; j++ ) printf( "%2d ", a[i][j] );
printf( "\n" );
}
}
The program output is
3 2 5
6 4 2
1 61 45
3 0 5
0 0 0
1 0 45