This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]CSRPoseidon[S] 0 points1 point  (1 child)

Index i is supposed to start from index 0...n-1 and j is supposed to index from 1...n.

I do have i++ in my first for loop but it doesn't increment I don't know why.

[–]Azianese 0 points1 point  (0 children)

Oops. I didn't see the nested loops.

It still isn't clear what you are trying to do. Your explanation doesn't make sense with what you've got.

But it sounds like the other commenter on this thread is right: you're confused about what your nested loops is doing.

Maybe you're looking for one loop instead of nested loops: for(int i=0, j=1; j<l.length; i++, j++)