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?
2 Answers
New Answerhttps://code.sololearn.com/cax7n1XjM7ST/?ref=app
12/8/2020 1:47:05 PM
Matias Bassi2 Answers
New AnswerHeap 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
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 !!
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message