Question

What is the purpose of using constants over literal in code?

What is the purpose of using constants over literal in code?

Homework Answers

Answer #1

Mostly we use constants instead of using literals in code. Some of the reasons why we use them are:

- It will avoid the risky errors that might occur in the large programs beacause that type of programs may contains huge number like 3.14 or 3.07 if the numbers are repeated errors will occur so it will avoid those.

- If any number contains through out the program then any change is needed we have re write the number, y using this it will save the changes we need not change the every time in the program it automatically changes.

- The code becomes more readable because of this.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
What is the purpose of using CMOS over gates? Provide reasoning for your answer.
What is the purpose of using CMOS over gates? Provide reasoning for your answer.
Write code to determine engineering constants for a single ply in the laminate coordinate system for...
Write code to determine engineering constants for a single ply in the laminate coordinate system for a ply for which engineering constants are known and measured through ASTM testing. Assume that these engineering constants are measured for a particular material: E11, E22, E33, v12, v13, v23, G12, G13, G23. (these are the inputs to the code). The second input to the code is the lamina angle relative to the laminate coordinate system. Run the following example (for a unidirectional lamina):...
Please Code in Assembly Language Code solution using the provided template AL_Template_Irvine32.asm located towards the bottom...
Please Code in Assembly Language Code solution using the provided template AL_Template_Irvine32.asm located towards the bottom of the question. Debug programs with Visual Studio2017/19. Please add single line or block comments explaining the purpose or functionality of your code statements. Draw Text Colors Write a program that displays the same string in four different colors, using a loop. Call the Set-TextColor procedure from the book’s link library. Any colors may be chosen, but you may find it easiest to change...
For 6-7, convert the C code to equivalent MARIE code. You may reference literal values using...
For 6-7, convert the C code to equivalent MARIE code. You may reference literal values using an immediate datum mode as in #1, or assume the value is in a variable of the same name (e.g., one). 6) scanf(“%d”, &x); z=0; for(i=0;i<x;i++)                 scanf(“%d”, &y); if(y==0) z++;                 }                 printf(“%d”, z);
Please Code in Assembly Language Code solution using the provided template AL_Template_Irvine32.asm located towards the bottom...
Please Code in Assembly Language Code solution using the provided template AL_Template_Irvine32.asm located towards the bottom of the question.. Debug programs with Visual Studio2017/19. Please add single line or block comments explaining the purpose or functionality of your code statements. 6.) Random Strings Create a procedure that generates a random string of length L, containing all capital letters. When calling the procedure, pass the value of L in EAX, and pass a pointer to an array of byte that will...
In the receiver VHDL code, what is the purpose of the statement:             elsif (Din =...
In the receiver VHDL code, what is the purpose of the statement:             elsif (Din = ‘1’) then timer <= 0     ? i.e. where does the ‘1’ in Din come from when a message is arriving?
What is the purpose of using standard costs?
What is the purpose of using standard costs?
what is the purpose of using concomitants with treatment drugs?
what is the purpose of using concomitants with treatment drugs?
What is the purpose of the cash short and over account? How does it affect the...
What is the purpose of the cash short and over account? How does it affect the income statement? in your own words
What is the purpose of using a standardized measure, such as the laterality quotient?
What is the purpose of using a standardized measure, such as the laterality quotient?