Counter controlled loops are where we know the number of loop executions beforehand. Unlike counter controlled loops, in sentinel controlled loops the number of loop executions in unknow at the beginning and depends on decisions made inside the loop.
Day: April 9, 2015
3 Differences between entry and exit controlled loops with examples. Entry controlled loops VS Exit controlled loops
The differences between the entry and exit controlled loops are as follows.Read More: What are the entry controlled and exit controlled loops? No. Topics Entry controlled loops Exit controlled loops 01 Test condition Test condition appears at the beginning. Test condition appears at the end. 02 Control variable Control variable is counter variable. Control variable is … Read more
Compare among the three loops. FOR loop VS WHILE loop VS DO….WHILE
Comparison among the three loop: The comparison among the three types of loops for loop, while loop and do….while loop is given below. Suggested Reading: What are the entry controlled and exist controlled loops? What are the counter controlled and sentinel controlled loops? No. Topics For loop While loop Do…while loop 01 Initialization of condition variable In … Read more
What are the entry controlled and exit controlled loops?
Loops in computer programs refers to a block of code that is executed over and over based on meeting some criteria or condition. However a loop can be broke or exited from inside the loop also. The block of code in a loop keeps on executing again and again unless it meets a certain condition … Read more
Write down the steps of looping process.
Steps of looping process: A looping process, in general, would include the following four steps. Setting and initialization of a condition variable. Execution of the statements of the loop. Test for a specified value of the condition variable for execution of the loop. Increasing or updating the condition variable. The above given steps may come at … Read more
What are the counter and sentinel controlled loops?
Based on the nature of the control variable and the condition or limit, the loops can be of two general categories; counter controlled and sentinel controlled loops. Counter controlled loops are where we know the number of loop executions beforehand. Unlike counter controlled loops, in sentinel controlled loops the number of loop executions in unknow at the beginning and depends on decisions made inside the loop.
What is loop
Loop A loop is a particular area of a program where some executable statements are written which gets execution by testing one or more conditions. So, in looping, a sequence of statements is executed until some conditions for termination are satisfied. A program loop therefore consists of two segments; the body of the loop and … Read more
What are the static arrays and dynamic arrays
Static arrays : The process of allocating memory at compile time is known as static memory allocation and the arrays that receives static memory allocation are called static arrays. This approach works fine as long as user know that what the data requirements are. Dynamic arrays : The process of allocating memory at run time is known … Read more
Write down the initialization of two dimensional array
Initialization of two dimensional array : Like the one dimensional arrays, two dimensional arrays may be initialized by following their declaration with a list of initial values enclosed in braces. For example, int table[2][3]={0,0,0,1,1,1}; This initializes the elements of the first row to 0 and the second row to 1. This statement can also be … Read more
Write down about the initialization of one dimensional array
Initialization of one dimensional array : After an array is declared, its elements must be initialized. An array can be initialized either of the following stages, § At compile time. § At run time. Compile time initialization : User can initialize the elements of an array in the same way as the ordinary variables when they are declared. This … Read more