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
Who made computer ? Which year?
myrzilka [38]

Answer:

The first computer that resembled the modern machines we see today was invented by Charles Babbage between 1833 and 1871.

8 0
3 years ago
Read 2 more answers
To make your brand colors stand out, it is important to implement what with your color scheme?
qaws [65]

Answer:

All of the above

Explanation:

It's better to have a pattern of colors than one single color in you color scheme.

6 0
3 years ago
Read 2 more answers
A company decides to create static design diagrams for an upcoming project. Which statement correctly describes the attribute of
kotykmax [81]

Answer:

A

Explanation:

4 0
3 years ago
Unlike bar codes and other systems, _____ devices do not have to be in contact with the scanner to be read.
UNO [17]

Answer:

radio frequency identification

Explanation:

7 0
3 years ago
You are given two arrays of integers a and b of the same length, and an integer k . We will be iterating through array a from le
rodikova [14]

Answer:

#include <iostream>

using namespace std;

int main(){

   int arr1[5], arr2[5], k = 7;

   arr1 = {1,3,5,3,6}

   arr2 = {1,3,2,4,4}

   int reverseA2[5];

   for (int x = 5; x > 0; x++){

       reverseA2[5-x] = arr2[x-1];

   }

   for (int i = 0; i < 5; i++){

       if ( arr1[i] + reverseA2[i] < k){

           cout<< arr1[i] << " , "<<reverseA2[i];

       }

   }

}

Explanation:

The C++ source code prints a pair of values from the arr1 and reverse arr2 arrays whose sum is less than the value of the integer variable value k.

4 0
3 years ago
Other questions:
  • Una pregunta cuales son los ataques de Sindel que por favor y me lo diga gracias
    11·1 answer
  • A poem for coduction
    15·2 answers
  • Web and mobile applications are created for users to only read information. True False
    15·2 answers
  • A _____ is inserted so that a portion of a document that can have different formatting from the rest of the document. a. heading
    9·1 answer
  • List and describe the tools for all the main stages of app/application development.
    11·1 answer
  • Once the term of copyright has expired,a work
    15·1 answer
  • To delete a row, you must first
    11·1 answer
  • Select the first ICMP Echo Request message sent by your computer, and expand the Internet Protocol part of the packet in the pac
    10·1 answer
  • Your task is to diagnose and correct the problem. In the computer, the top hard drive contains the operating system files. Troub
    14·1 answer
  • How is blockchain different from traditional database models?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!