+ 1

Can anyone help me with this task?

I need to create a new array in dynamic memory and the function must return a pointer to that array, but I don't understand how I can do it https://code.sololearn.com/cgJcS39K0ePh/?ref=app

5th Nov 2019, 8:37 PM
Rainbow Pie
2 Antworten
+ 2
There are number of problems Line 17, you set an abject it to the pointer. The type is wrong and you try yo write over the pointer which point to the array you have allocated on line 15. You should delete line 17 Before your two returns, lines 35 and 52, you need to free the memory you have allocated Before 35: free(items); Before 52: free(tmp_items); Your move function doesn't work if k>=n, you should it after you get the value of k, line 41
5th Nov 2019, 10:20 PM
David Frydman
David Frydman - avatar
+ 2
The function move need to return an integer, and also the function main
5th Nov 2019, 10:21 PM
David Frydman
David Frydman - avatar