answersLogoWhite

0

Variables don't have any "actions". A variable provides storage for a value, nothing more. A counter variable is typically used in a bounded for loop. A for loop has three clauses, each of which is optional. The first clause is the initialiser which can be used to initialise a control variable upon entry to a bounded loop. The second clause is the conditional expression which is evaluated at the start of each iteration. If that expression evaluates false, execution passes to the statement following the for statement, otherwise the body of the loop executes. The second clause is typically used to test the control variable is within the bounds of a bounded loop. The third clause is an operation that will be performed at the end of each iteration. In a bounded loop, this clause is typically used to increment the control variable. For example:

for (int x=0; x<10; ++x) {

/* ... */

}

The above loop is a bounded loop that will execute the body of the loop 10 times. The control variable, x is first initialised to 0. At the start of each iteration, if x<10 is true, the body of the loop will execute one iteration. At the end of each iteration, the ++x statement increments x. When x is 10, the x<10 expression becomes false and execution passes to the statement immediately after the for loop.

User Avatar

Wiki User

9y ago

What else can I help you with?

Related Questions

What are the index variable in the for loop?

The for loop uses a counter or an index variable to loop through the statements. This variable is used through the loop, changed and finally compared with the loop condition for consideration of the loop's next cycle. The variable(s) used inside the for loop for comparison (with the mentioned condition) and increment/decrement is know as the index variable. for example (Java) : for(int i=1; i&lt;5; i++){ ... } in this example, integer 'i' is the index variable.


What is the difference between normal resistance and potentiometer?

Resistors are either fixed value, or variable. A variable resistor has three terminals; one at either end and one attached to a moving 'wiper', and can be connected either as a potentiometer or as a rheostat. So 'potentiometers' and a 'rheostats' are different applications for variable resistors. A potentiometer uses all three terminals, and is used to control levels of potential; whereas a rheostat uses just two of the three terminals, and is used to control current.


What are marbles uses?

one of marbles uses are counter tops


What engine does Counter Strike Source use?

Counter Strike: Source uses the Source engine.


A sentence for the word dependent variable?

In an experiment you uses a independent and dependent variable.


What are the uses for a decade counter?

The use of a decade counter is to store or keep track of something happening or an event . Usually, counter circuits are digital in nature.


What are uses of potentiometer?

A potentiometer is a variable resistor used in electronics.


What is the mercantile scale?

it is a scale that uses counter weight and balance


What is a radiation detector that makes the use of gas filled metal tube?

The Scintillation Counter uses a gas-filled metal tube.The Geiger Counter uses a phosphor-coated surface.


Do half life mods work on steam downloaded counter strike?

No, counter-strike only uses the same engine.


What are the 2 uses of variable resistor?

User controls Preset adjustment


What bank uses routing 560210039?

What US Bank uses 560210039 routing number on counter deposit slips?