sizeof(int*)
returns the size of a pointer, while sizeof(int)
returns the size of an integer -- the two are NOT the same. And the lines you quoted are not the same either. Example: assume nrows = 10, ncols = 5 and sizeof(int) = 4. The first equation is 10 * 5 * 4 = 10 * 20 = 200. The second equation assume sizeof(int*) = 4, then 10 * 4 = 40. Clearly the two equations do not result in the same value.
Another way to look at those two code snippets you posted: the first allocates memory for a two dimensional array of integers while the second allocates memory for a one dimensional array of pointers.