When continue is encountered inside any loop, control automatically passes to the beginning of the loop. A continue is usually associated with an if.

Example :

main( )

{

int i, j ;

for ( i = 1 ; i <= 2 ; i++ )

{

for ( j = 1 ; j <= 2 ; j++ )

{

if ( i == j )

continue ;

printf ( "\n%d %d\n", i, j ) ;

}

}

}

The output of the above program would be...
1 2
2 1

The continue statement takes the control to the for loop (inner) bypassing rest of the statements pending execution in the for loop (inner).

The do-while Loop

The do-while loop looks like this:

do
{
this ;
and this ;
and this ;
and this ;
} while ( this condition is true ) ;

The difference between the working of while and do-while loops. This difference is the place where the condition is tested. The while tests the condition before executing any of the statements within the while loop. As against this, the do-while tests the condition after having executed the statements within the loop.

This means that do-while would execute its statements at least once, even if the condition fails for the first time. The while, on the other hand will not execute its statements if the condition fails for the first time.(151)
The previous post of the blog deals with Requirements testing technique.

Related posts about C Language Programming:

Operators
If statement
Multiple if's
IF-Else
Nested if's
Break statement

Other Programming Courses :

ASP.NET part one and two
Programming with C and C Sharp
Dot Net Complete Course Part one and two
Interview Questions in dot net and asp.net part one part two
Software Testing Complete course part one and two
Interview Questions in software Testing
Complete software testing course here as basic and advanced parts .

Thank you for visiting PROGRAMMING BLOG. If you liked the post, please subscribe to my blog via email or RSS FEED.You can contact me here for any specific feed back .

0 comments

Post a Comment