Please help to find the error in my code | SoloLearn: Learn to code for FREE!


Please help to find the error in my code

The concept of code in written inside it So make sure to read the first lines"comments" to understand it clearly And thanks for every one who is going to make an effort to understand my code

3/1/2020 2:25:04 PM

amal 01

1 Answer

New Answer


In allocatematrix you allocate an array of length row of Arrays of length column (I suspect you forgot to translate the array Dimension ligne and colonne). Later on you access as if it would be a continous memory Block you had allocated. This is Not the case! Two solution ideas: 1. Really allocate one big chunck of raw memory and Do indexing for your own Int* matrix=(*int) mallow(row*column*sizeof(int)) 2. Access everywhere your Two Dimension separately, in reading, writing and free_memory. E. G. In allocatematrix *((*(ptr+i)) +j) =val;