I have a pointer pointing to a 2D array of ints with dimensions [N][M] with M even. I define it allocating the memory as follows:
//alocate the memory of indxs pointer containing the indexs of each matrix element
int **indxs;
indxs = (int**) malloc(N*sizeof(int *));
for(i = 0; i<N; i++){
indxs[i] = (int *) malloc(M*sizeof(int));
}
Once filled I want to compare for each row (i_N) if the first half of the elements indxs[i_N][:M/2]
is equal to the second half of the elements indxs[i_N][M/2:]
. This [:M/2]
is Python notation, I don't know how to do it in C, Any suggestion?. I have read in another post that for comparing the content of two pointers you have to dereference them first:
int *a = something;
int *b = something;
*a==*b
But how can this be done in my case?