Ask Question
5 November, 15:53

How is a most recent variable different from a fixed variable

+5
Answers (1)
  1. 5 November, 16:14
    0
    In this program, there are three variables: data, count, and value. In the first loop, a user is requested to enter the number of values to be later processed in the second loop. This number is requested repeatedly until the user gives a positive value. The variable data is used to store the latest input read, and there is no possibility for the program to guess what values the user will enter.

    The variable value is used similarly in the second loop: it stores the latest input, and there is no known relation between its successive values.

    The variable count, however, behaves very differently. Once it has been initialized its future values will be known exactly: it will step downwards one by one until it reaches its limiting value, i. e. zero.

    In the following the variables data and value are said to have the role most-recent holder (as they store the latest value in some value succession - user input in this case), and the variable count is said to be a stepper. These roles occur in programs again and again. In fact, only ten roles are needed to cover 99 % of all variables in novice-level programs.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “How is a most recent variable different from a fixed variable ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers