Quote Originally Posted by linuxdev View Post
Query:
1. Is the above mentioned code snippet safe to use?
Still, I would use the stack for the container classes... And the if in the for scope is not necessary, also use "++k".

2. I have done much of coding with QVector, how do i delete the item before removing it?
is it like, i have to call these two statements to do that?
delete vector.at(i) ;
vector.remove(i) ;
No, but whith a list it's much shorter.
Qt Code:
  1. delete list.takeAt(i);
To copy to clipboard, switch view to plain text mode 

3. Can i use QList instead of QVector, as i need a Dynamic Array to store my elements, or is there any other better container for this problem?
Depends on your needs. With QList you can do hardly something wrong. But there are also LIFO LILO containers. Yust choose the the one, which fits your accessing needs best.