Hopefully I am not being a pain but in this line:
for(i=0;i<t;i++)
At the end, isn't i == t, so that i<t becomes false to end the loop?
This would only be a problem if i==t, j==t, k==t would cause a problem elsewhere in your program.
It's just that every time I see
for(a=0;a<=i;a++)
instead of
for(a=0;a<i;a++)
, I think it is a very common way to cause a memory error - and that is exactly what you have. I am bound to be wrong (it's not the first time & certainly not the last !!)
Just to be thoroughly annoying, do you have a reason for wanting to loop i+1 times?
since you see although a goes all the way up to i, i is always < t. |
So I am saying i==t and even though a goes all the way up to i, the loop executes i+1 times (or tries to).
Any way that's it - I will shutup now - I fear I have already made a clown of myself.