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
saveliy_v [14]
3 years ago
12

Assume you are programming an embedded microcontroller in C and want your code to follow good software engineering practices, be

as portable as possible, and not be wasteful of memory. You need to select a variable that can hold an integer from 0 to 132. What is the best choice for the variable type?
Engineering
2 answers:
Olegator [25]3 years ago
5 0

Answer:

unsigned char

Explanation:

Selecting best data type depends upon the application. Memory and portability are some of the considerations while selecting a data type.

For the given scenario, we need to store an integer in the range of 0 to 132.

Lets have a look at some of the options available for variable data types.

Type: signed char

storage size: 1 byte

Range: -128 to 127

Type: unsigned char

storage size: 1 byte

Range: 0 to 255

Type: int

storage size: 2 byte

Range: -32,768 to 32,767

Unsigned char would be best choice since we need to store only positive integers and it gives us range 0 to 255 which is more than enough for our case and storage size is also least. Other data types are simply too big to consider for this scenario and hence they will be a wasteful of memory.

Please note that the name of data type is "char" but that doesn't mean that we cannot store integer values in it. In-fact in embedded micro-controller environment, char is often used for storing one byte integers.

insens350 [35]3 years ago
4 0

Answer:

unsigned char

Explanation:

The different data types with their sizes and range are given as follows,

  • char - 1 byte - Value: -128 - 127
  • unsigned char- 1 byte - Value: 0 - 255

All other data types including integers, float, double require 2 bytes or more. Therefore, the data type with the smallest size that can hold values from 0 to 132 is unsigned char.

You might be interested in
A certain working substance receives 100 Btu reversibly as heat at a temperature of 1000℉ from an energy source at 3600°R. Refer
Valentin [98]

Answer:

Explanation:

t1 = 1000 F = 1460 R

t0 = 80 F = 540 R

T2 = 3600 R

The working substance has an available energy in reference to the 80F source of:

B1 = Q1 * (1 - T0 / T1)

B1 = 100 * (1 - 540 / 1460) = 63 BTU

The available energy of the heat from the heat wource at 3600 R is

B2 = Q1 * (1 - T0 / T2)

B2 = 100 * (1 - 540 / 3600) = 85 BTU

The reduction of available energy between the source and the 1460 R temperature is:

B3 = B2 - B1 = 85 - 63 = 22 BTU

6 0
3 years ago
At a retirement party, a coworker described terry as dedicated
denis23 [38]

Answer:

At a retirement party, a coworker described Terry as dedicated, hardworking, and dependable. He also said that Terry was a great leader, knew the computer system, and kept the company's finances in order

8 0
3 years ago
A natural-draft cooling tower receives 250,000 ft3/min of air at standard atmospheric pressure, 70oF, and 45 percent relative hu
notsponge [240]

Find the attachment for complete solution

5 0
3 years ago
Input Energy ---> Output Energy
uranmaximum [27]

Answer:

motion ------> electrical. winds push the turbines which generate a magnetic fields which in turn, generates electricity

4 0
3 years ago
53. The plan of a building is in the form of a rectangle with
schepotkina [342]

Answer: 150m

Explanation:

The following can be depicted from the question:

Dimensions of outer walls = 9.7m × 14.7m.

Thickness of the wall = 0.30 m

Therefore, the plinth area of the building will be:

= (9.7 + 0.30/2 + 0.30/2) × (14.7 × 0.30/2 + 0.30/2)

= 10 × 15

= 150m

7 0
3 years ago
Other questions:
  • Kirchoff's Law states that, by the time current has returned to its source, all
    13·2 answers
  • Admission to an aquarium is $14 per person. There is also an IMAX theatre in the building, which charges $8 per ticket for a 3D
    8·1 answer
  • "A computer architect redesigns the pipeline above to enable branch prediction. When PCSrc is asserted (branch taken) IF/ID is f
    10·1 answer
  • WHAT IS A TOROID IN HYDRAULUCS?
    11·2 answers
  • A thick oak wall (rho = 545 kg/m3 , Cp = 2385 J/kgK, and k = 0.17 W/mK) initially at 25°C is suddenly exposed to combustion prod
    11·1 answer
  • For a steel alloy it has been determined that a carburizing heat treatment of 14 h duration at 809°C will raise the carbon conce
    13·1 answer
  • Multiple Choice
    10·1 answer
  • Is a unit of measurement for angles
    15·1 answer
  • What document should you have from the engine manufacturer when working on an engine
    8·1 answer
  • Evaluate, please show work as I don't understand. thanks
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!