The following expression can be used to access an element of the array.

*(a + i * cols + j)

1. "a" points to the 0th element of the list; this is a constant.
2. cols is the number of columns in a row; this is a constant.
3. i ranges from 0 to number of rows to be searched - 1.
4. j ranges from 0 to number of columns to be searched - 1.

Array elements are stored in consecutive linear memory locations. We can use pointer arithmetic to access these elements. The expression a + i * cols + j provides the offset into memory from the beginning of the list.