Prepare for your Next Interview
This is a discussion on Simple for loop within the C and C++ forums, part of the Software Development category; Hi guys, main() { int i=0, j=0,z=0; For(i=0; j,z;i++) printf("i = %d\n",i); } what does this mean????? how does the ...
|
|||
|
Re: Simple for loop
Not at all.
Your snipplet does nothing. If you set j and z to true, you have an endless loop. here a for how it's used normally Code:
main() {
int i=0;
for(i=0;i<11;i++) {
printf("i = %d\n",i);
}
}
|
|
|||
|
Re: Simple for loop
Hello,
your for loop will do nothing. bcz, it will check the value of j and if it is non zero ,it will execute the printf(). Here it is zero , so wont do anything |
|
|||
|
Re: Simple for loop
I have a doubt as to whether more than one condition can be tested in for loop....
|
|
|||
|
Re: Simple for loop
in for loop we can go for multiple condition.
your for loop , i.e. syntactically correct , but you'll not get any output, due to condition always 0 , means false . so won't execute next statement. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How many times the while loop execute | chandanavemulapally | C and C++ | 7 | 02-26-2008 01:02 PM |
| Even and odd loop | deblina | C and C++ | 11 | 01-17-2008 07:34 AM |
| Run report without resolving loop | sonies | Data Warehousing | 2 | 12-13-2007 04:00 AM |
| Implement FOR Loop | Geek_Guest | QTP | 1 | 10-23-2007 05:26 AM |
| Store Value using loop in procedure | talha_saeed | SQL | 2 | 10-23-2007 02:03 AM |