I've a 2-d array declared as such

lower_tri = (float **)malloc(sizeof(float *)*(dimention));
for(i =0; i < dimention; ++i)
	lower_tri[i] = (float *)malloc(sizeof(float)*(i+1));

So that it looks like...

However, it causes a segmentation fault when I try to de-allocate the array with


(only in unix, Windows works fine)

I've tried using a for loop to deallocate the array row by row, but just come up with more errors.

Any idea how to deallocate this array?

the array has to be deallocated in the reverse order that it was allocated

for(i =0; i < dimention; ++i)

If you get seg fault with that then it means the program has been corrupted somewhere.

I'm sure it has. You're having an out-of-bounds array access somewhere.
Have you run this with valgrind yet? It can discover invalid memory accesses in some cases.

Why did you create two threads for the same problem??? See your other thread for solution.