I am not sure how your second post relates to the first. In the second you declared two arrays of double (c & d) which you did not initialize (so they are all zero). Even if you fixed that, your use of each array ( c[2*i+1] and d[2*i] ) over the range i = 1 to 10 would produce indices which were out of bounds of the arrays.