Please help to find the error in my code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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 https://code.sololearn.com/ct5R8po9hz8O/?ref=app

1st Mar 2020, 2:25 PM
Amal Gil
Amal Gil - avatar
1 Answer
0
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;
1st Mar 2020, 9:49 PM
Volker Milbrandt
Volker Milbrandt - avatar