• + 0 comments

    I guess array's element have some default initial value other than zero and when you are adding the element to it, some wrong values get stored. You must intilialize the elements of array to zero first.