[Qt-interest] Unexpected behaviour for loop
Karol Krizka
kkrizka at gmail.com
Thu May 28 09:37:12 CEST 2009
On Thu, 2009-05-28 at 10:28 +0300, Parker wrote:
> Hello,
> I noticed something strange while using the for loop. Here :
>
> for(int i = 1;i < integerList.size();i++)
>
> {
>
> }
>
>
>
> "i" should be initialized to 1 and we should enter the loop. But it's
> not happenig. I debuged, the i variable is just not initialized.
>
> Is this correct behaviour, maybe I am missing something ?
>
How many items in your list? If only 1 item, then the loop will never
start because 1(=i) is not < 1 (integerList.size()). Try running with
i=0.
--
Cheers,
Karol Krizka
http://www.krizka.net
More information about the Qt-interest-old
mailing list