Divisible subarray

What is the need to use memset and without that why is the answer coming wrong?

hi anindya,
You can run this code without memset,but the code which is working correctly and the other which is not.There are some changes which were done.

  1. Presum was declared globally which is wrong as it needs to be updated with 0 after every testcase.
    2.Size was taken 100005 which is less than the constraints.
    3.You also forgot to intialise presum[0]=1 in wrong code.
    I have marked those changes in following code:
    https://ide.codingblocks.com/s/321503
    Please let me know if there is any other doubt.