Isn’t double[][] equivalent to **double?

No.
A double** is a pointer to a pointer to a double (double*).

So actually it should be created like this (note the extra * in the first malloc sizeof()):

  double** result = (double**) malloc(sizeof(double*)*4);
  for (int i = 0; i < 4; i++) {
       result[i] = (double*) malloc(sizeof(double)*4);
  }

So in memory it would look like this:

[] -> { d,d,d,d }
[] -> { d,d,d,d }
[] -> { d,d,d,d }
[] -> { d,d,d,d }

There are 4 buffers that hold 4 doubles, but are not continuous.

While your double[4][4] is a continuous buffer in memory, like this:

 { { d,d,d,d } { d,d,d,d } {d,d,d,d} {d,d,d,d} }

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)