0

Hi ! I just solve DejaVu Challenge in C, but rigth to the point. do you think it can be improved by using malloc for list array?

https://code.sololearn.com/cax7n1XjM7ST/?ref=app

8th Dec 2020, 1:47 PM
Matias Bassi
Matias Bassi - avatar
2 Answers
0
Heap allocation won't improve this great code. Only one thing reducant is that {0*LIST_SIZE} is as same as {0}. You don't need to do multiplication. You might need to read some posts like Heap vs Stack. I suggest viewing this thread: https://stackoverflow.com/questions/161053/which-is-faster-stack-allocation-or-heap-allocation
8th Dec 2020, 2:07 PM
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż - avatar
0
Oh thanks! I'll have a look at it.. Yes! That multiplication has no sense 😅. I wanted to initialize the whole array with zeros but I better use a for. That idea came to me from anoter language, but it works just for characters Thanks CarrieForle !!
8th Dec 2020, 2:46 PM
Matias Bassi
Matias Bassi - avatar