I have a 2 dimentional array where i need to check if row and colum number is the same, and i need to do it using arrays, not the usual n==m

Code:#include <stdio.h> #include <stdlib.h> int main() { int **p,i,j,n,m; srand(time(NULL)); n=rand()%10; m=rand()%10; p = (int **)malloc(n*sizeof(int)); for(i=0;i<m;i++);{ p[i]= ((int*)malloc(m*sizeof(int)));} for(i=0;i<n;i++){ for(j=0;j<m;j++){ *(p+i+j)=rand() % 10; } }