Why is my code skipping a whole for loop? : <p>I'm still learning the basics of C and I had this assignment of coding a program that shows the product of two 2D arrays entered by the user. The idea is to not make use of memory functions like malloc. </p>

<p>The code worked fine but when I added an if statement to check that the rows of the first array are equal to the columns of the next one during the run-time the whole part for entering the data of the first array and showing it is skipped and it goes directly to asking for the next array. I've tried to clean the buffer and use getch() trying to force the compiler to execute that part but it keeps being skipped.</p>

<p>Here's the whole code : </p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;ctype.h&gt;
#include &lt;conio.h&gt;
int main(void);
int main (void)
#define MAXR 36
#define MAXC 18 
{
    int Rows_A,Columns_A,Rows_B,Columns_B,Rows_C,Columns_C;
int Counter_Rows=0,Counter_Columns=0,Counter_Multiplier=0;
int Matrix_A[MAXR][MAXC],Matrix_B[MAXR][MAXC],Results_Matrix_C[MAXR][MAXC];
printf("\n\tTo multiply two matrices both have to be the same size of rows from the first matrix and the columns from the next one. \n\tPlease enter the size of the matrices:\n");

printf("\n\tMatrix A:\n\tNumber of rows :\t\t");
scanf(" %d",&amp;Rows_A);
printf("\n\tNumber of columns :\t\t");
scanf(" %d",&amp;Columns_A);
printf("\n\tMatrix B:\n\tNumber of rows :\t\t");
fflush(stdin);
scanf(" %d",&amp;Rows_B);
printf("\n\tNumber of columns :\t\t");
scanf(" %d",&amp;Columns_B);
if (Rows_A=!Columns_B)
{
    printf("\n\tMatrix B number of columns and Matrix A number of rows are not the same therefore they cannot be multiplied.");
    return 0;
}
else
{
    Rows_C=Rows_A;
    Columns_C=Columns_B;
    printf("\n\tEnter the data for Matrix A:");
    for (Counter_Rows=0;Counter_Rows &lt; Rows_A;Counter_Rows++)
    {   
        for(Counter_Columns=0;Counter_Columns &lt; Columns_A; Counter_Columns++)
        {
            printf("\n\tEnter the value of the position [%d][%d] of the matrix A:  ",Counter_Rows+1,Counter_Columns+1);
            scanf(" %d",&amp;Matrix_A[Counter_Rows][Counter_Columns]);
        }
    }
    printf("\n\tMatrix A.\n\t");//Matrix A
    for (Counter_Rows= 0; Counter_Rows &lt; Rows_A; Counter_Rows++)
    {
        for (Counter_Columns= 0; Counter_Columns &lt; Columns_A; Counter_Columns++)
        {
            printf("[%d] ",Matrix_A[Counter_Rows][Counter_Columns]);
        }
        printf("\n\t");
    }
    fflush(stdin);
    printf("\n\tEnter the data for Matrix B:");
    for (Counter_Rows=0;Counter_Rows &lt; Rows_B;Counter_Rows++)
    {
        for(Counter_Columns=0;Counter_Columns &lt; Columns_B; Counter_Columns++)
        {
            printf("\n\tEnter the value of the position [%d][%d] of the matrix B:  ",Counter_Rows+1,Counter_Columns+1);
            scanf(" %d",&amp;Matrix_B[Counter_Rows][Counter_Columns]);
        }
    }
    printf("\n\tMatrix B.\n\t");//Matrix B.
    for (Counter_Rows= 0; Counter_Rows &lt; Rows_B; Counter_Rows++)
    {
        for (Counter_Columns= 0; Counter_Columns &lt; Columns_B; Counter_Columns++)
        {
            printf("[%d] ",Matrix_B[Counter_Rows][Counter_Columns]);
        }
        printf("\n\t");
    }
    //Calculating product matrix C.
    for (Counter_Rows=0;Counter_Rows &lt; Rows_C;Counter_Rows++)
    {
        for(Counter_Columns=0;Counter_Columns &lt; Columns_C; Counter_Columns++)
        {
            //initializes the Matrix  C in 0's
            Results_Matrix_C[Counter_Rows][Counter_Columns]=0;
            for(Counter_Multiplier=0; Counter_Multiplier &lt; Columns_A; Counter_Multiplier++)
            {
                Results_Matrix_C[Counter_Rows][Counter_Columns]=Results_Matrix_C[Counter_Rows][Counter_Columns]+(Matrix_A[Counter_Rows][Counter_Multiplier]*Matrix_B[Counter_Multiplier][Counter_Columns]);
            }
        }
    }
    printf("\n\tProduct Matrix C:\n\t");//Matrix B.
    for (Counter_Rows= 0; Counter_Rows &lt; Rows_C; Counter_Rows++)
    {
        for (Counter_Columns= 0; Counter_Columns &lt; Columns_C; Counter_Columns++)
        {
            printf("[%d] ",Results_Matrix_C[Counter_Rows][Counter_Columns]);
        }
        printf("\n\t");
    }
}
return 0;
</code></pre>

<p>}</p>

<p>This is the part that is skipped : </p>

<pre><code>printf("\n\tEnter the data for Matrix A:");
    for (Counter_Rows=0;Counter_Rows &lt; Rows_A;Counter_Rows++)
    {   
        for(Counter_Columns=0;Counter_Columns &lt; Columns_A; Counter_Columns++)
        {
            printf("\n\tEnter the value of the position [%d][%d] of the matrix A:  ",Counter_Rows+1,Counter_Columns+1);
            scanf(" %d",&amp;Matrix_A[Counter_Rows][Counter_Columns]);
        }
    }
    printf("\n\tMatrix A.\n\t");//Matrix A
    for (Counter_Rows= 0; Counter_Rows &lt; Rows_A; Counter_Rows++)
    {
        for (Counter_Columns= 0; Counter_Columns &lt; Columns_A; Counter_Columns++)
        {
            printf("[%d] ",Matrix_A[Counter_Rows][Counter_Columns]);
        }
        printf("\n\t");
    }
</code></pre>
