What is a counter? What does it mean to initialize and update a counter in a program?

What will be an ideal response?


A counter is a numeric variable used for counting something, such as the number of employees paid in a week. You initialize a counter to assign a beginning value to it, and a counter is usually initialized to the number 0. You update a counter by adding a number to or subtracting a number from the value stored in the counter. A counter is always updated by a constant number, and it is updated each time the loop instructions are processed.

Computer Science & Information Technology

You might also like to view...

List four benefits of either replacing the campus or corporate routers with layer 3 switches or adding layer 3 switching to a router-less network.

What will be an ideal response?

Computer Science & Information Technology

Which option will allow you to increase the height of the Page Header using the mouse?

A. change the Height property of the Page header section B. set the Can Grow property to Yes C. drag the Page Header border down to the desired height D. click on the ruler at the desired height setting

Computer Science & Information Technology

The length of a video does not affect its download time.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The control variable in a flag-controlled while loop is a bool variable.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology