See a problem in else if statement

Dangling else problem

Image
Hello, This problem comes when we use else if statement and do some mistake more describe is given below......... Dangling else problem: One of the major problem with nested if is dangling else problem. The problem arises when both outer if statement inner if statement might pair with common else statement. Thus the compiler is not able to judge to pair the else with which statement. The solution to this problem is given by the compiler that it pairs else with the recent if thus sometimes giving wrong result.                                           Hence the programmer should put early bracket wherever required. This post is may very short because my only aim was to describe this problem. Thank you, Keep supporting............. 

Looping part 2

This is second part of looping here we continue our looping topic-




Do-while:

Do while loop is an exit control loop in which condition is tested on the exit of loop. The do while loop execute at least ones even if the condition is false.

syntax:

do
{
body_loop;
}
while( test expression);

For loop:

It is an entry control loop in this initializing of counter variable test expression, modification of counter variable is done at one

syntax:

for(initialization ; test expression ; modification of counter)
{
body_loop;
}

while executing the for loop. Initialized is done only once with the start of the execution of for loop.
                              The test expression is checked if the expression evaluated to be true the body of the loop is executed the loop counter modified accordingly. the above two steps keeps or repeating till the test expression evaluated to be true.
Thank  you,
related to any this or another post question please comment below.

Comments

Popular posts from this blog

Libraray Fine Hackerrank solution in C || Balanced Brackets Hackerrank solution in C

Permutations of Strings hackerrank solution in C || Permutations of Strings

Introduction to C part 2