Problem in for loop (TC++ IDE)

2 views
Skip to first unread message

aveo

unread,
May 26, 2005, 2:24:15 AM5/26/05
to pe...@googlegroups.com
hi all,
I came accross some problem in executing for loop.

void main()
{
for(;0;cout<<1)
cout<<2;
}

it gives me 21 as an output instade of blank output. Please
let me know the reason behind it, as early as possible.

niz...@gmail.com

unread,
May 26, 2005, 5:40:01 AM5/26/05
to pe...@googlegroups.com
you conditional is "0", your loop not work.

the for statement has the form

for (exp1; exp2; exp3)

where exp1 is a series of initial statement separated by commas; exp2
is a conditional test; and exp3 is a series of statements executed at
the end of each loop iteration.

ranafaisal

unread,
May 28, 2005, 3:32:24 AM5/28/05
to pe...@googlegroups.com
why you want to perform this type of loop so change this condition to 1
and check.

Reply all
Reply to author
Forward
0 new messages