1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lelu [443]
4 years ago
9

Why should you use a named constant for the size of an array?

Computers and Technology
1 answer:
Brut [27]4 years ago
3 0
I can think of the following reasons:

- Avoid magic numbers. The constant will have a descriptive name like "MAX_MEASUREMENTS" so it can be inferred what the array size really means.

- Avoid duplication. There could be some related code (e.g., code that checks if an index is within the array bounds) that can benefit from using the same constant. Then it makes sense to tie them together such that if you change the constant, you're actually changing all its occurrances.

- Central configuration. By placing all your constants in a centralized place in the code, it is clear to see where your configuration resides. This is easier than having magic numbers scattered throughout the code.
You might be interested in
What should the timing of transition slides be per minute?
PolarNik [594]

How Many Slides to Use in a Presentation and for how long?

In the past if you asked a presentation skills “pundit” you were likely to hear “one slide per minute,” but times are changing and I don’t think the answer is as simple as a certain number of slides per minute. A presentation slide is supposed to be on for 15 seconds and stop to ask if anyone has any questions, if you are explaining something or reading alond with the slide it could be as long as you want it to be.

5 0
3 years ago
Read 2 more answers
Consider the following code segment.
Bingel [31]

Answer:

A.)

arr[0] = 10;

arr[1] = 10;

Explanation:

Given the array:

arr = {1,2,3,4,5}

To set the first two elements of array arr to 10.

Kindly note that ; index numbering if array elements starts from 0

First element of the array has an index of 0

2nd element of the array has an index of 1 and so on.

Array elements can be called one at a time using the array name followed by the index number of the array enclosed in square brackets.

arr[0] = 10 (this assigns a value of 10 to the index value, which replace 1

arr[1] = 10 (assigns a value of 10 to the 2nd value in arr, which replaces 2

3 0
3 years ago
_____ refers to unsolicited commercial emails, usually sent to a large number of people with little regard to the users interest
frozen [14]
Spam refers to large unsolicited email irregardless of the recipients views on the matter
5 0
4 years ago
Which of the following is the most significant outcome of the formation of the SMPTE?
olga55 [171]

Answer:

The SMPTE created an organized system of film technology, development, and distribution.

Explanation:

The SMPTE opened the door for Union organization within the film industry is true but not the most significant outcome of the formation of the SMPTE. However, the second option is certainly the most significant outcome as SMPTE is the most organized system of film technology, development, and distribution. And the other two options are also correct but the most significant outcome of the formation of the SMPTE is the second option.

7 0
3 years ago
Many professional photographers take pictures of people. What skills would someone have to have to be successful in these types
Galina-37 [17]
Wedding photographer
you are taking pictures of large groups of all kinds of people from 2 different sides of a family 

could you add me as best answer if this is correct?

7 0
4 years ago
Other questions:
  • From the Start screen, you can A. access recently opened Excel workbooks. B. create a document from a template. C. create new bl
    12·2 answers
  • Return a version of the given string, where for every star (*) in the string the star and the chars immediately to its left and
    5·1 answer
  • Explain what middleware is. Name a common middleware in two-tier client/server architecture for database applications.
    10·1 answer
  • What icons in the toolbar change the look of the presentation text? It’s either Drawing, Formatting,Presentation, or Standard
    9·2 answers
  • At year end, Clean123 Inc. has 45500 in cash, 55000 in accounts receivable, 54400 in service equipment, 550 in prepaid insurance
    12·1 answer
  • Write the implementation of a class Cse20 Topic that represents a topic in the cse20 class. The class should implement the init
    13·1 answer
  • Which kind of typography focuses on the details of a character?
    10·1 answer
  • Who was the father of computer?????​
    11·2 answers
  • What is the output from main (below) after the following function is called. void calculateCost(int count, double& subTotal,
    9·1 answer
  • Given an array of integers a, your task is to calculate the digits that occur the most number of times in the array. Return the
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!