After finally completing my code. I am trying to add some standard errors. One of the errors I want to do is if the number of entries in matrix that user inputs exceeds the actual number their should be than an error should pop up. This is actually quite simple and I have done it a couple of times but it is not working this time. The error is in my matrix_fill function. Only posting a bit of my code since its very long.

Code:#include<stdio.h> #include <stdlib.h> void matrix_display(int **A, int row_size1, int col_size1); int **matrix_alloc(int row_size1, int col_size1); void matrix_fill(int **A, int row_size1, int col_size1); int main(void) { int row_size1[5],col_size1[5],flag=1; int **A = NULL; int **p1, **p2; char c,k1,k2; do { printf("\ncmd > "); c = getchar(); if (c == 'A') { scanf("%d %d", &row_size1[0], &col_size1[0]); A = matrix_alloc(row_size1[0],col_size1[0]); matrix_fill(A,row_size1[0],col_size1[0]); matrix_display(A,row_size1[0],col_size1[0]); } while (flag == 1); return 0; } void matrix_display(int **A, int row_size1, int col_size1) { int i, j; printf("The required matrix is\n"); for (i = 0; i < row_size1; i++) { for (j = 0; j < col_size1; j++) printf("%d ", A[i][j]); printf("\n"); } } int **matrix_alloc(int row_size1, int col_size1) { int i; int **result = malloc(row_size1 * sizeof(int *)); for (i = 0; i < row_size1; i++) { result[i] = malloc(col_size1 * sizeof(int)); } return result; } void matrix_fill(int **A, int row_size1, int col_size1) { int i, j; // printf("Enter matrix of %d rows and %d columns\n", row_size1, col_size1); for (i = 0; i < row_size1; i++) { for (j = 0; j < col_size1; j++) { scanf("%d", &A[i][j]); } } if(j>0){ fprintf(stderr, "the number of entries is not valid\n"); exit(1);} }