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
Bryan a project manager and his team have been assigned a new project. The team members have already started working on their as
Vedmedyk [2.9K]

Answer:

there teams management is good

4 0
3 years ago
Liệt kê 10 quá trình sản xuất trong công nghiệp có sử dụng chất xúc tác
Ugo [173]

Answer: English please!

Explanation:

3 0
3 years ago
A piston moves a 25kg hammerhead vertically down 1m from rest to a
UkoKoshka [18]

Answer:

Total change in energy = 31 KJ.

Explanation:

Mass m=25 kg

Height h = 1 m

Initial velocity = 0

Final velocity = 50 m/s

Energy at initial condition

E_1=mgh+\dfrac{1}{2}mv^2

E_1=25\times 10\times 1+0

E_1=250\ J

Energy at final condition

E_2=0+\dfrac{1}{2}\times 25\times 50^2

E_2=31250\ J

So the change in energy = 31250 -250 J

The total change in energy = 31000 J

5 0
4 years ago
Read 2 more answers
Thermal energy is...
Yuki888 [10]
B because thermal has to do with temperature and it’s the amount of kinetic and potential energy in and object
4 0
3 years ago
Read 2 more answers
Lois is in high school and enjoys studying math and science subjects. She aspires to get into the robotics industry after comple
Inessa [10]

Answer:

d.partivipate in a robotic club

hope helps

mark me please

4 0
3 years ago
Other questions:
  • A cylinder contains 480 cm3 of loose dry sand which weighs 820 g. Under a static load of 200 kPa the volume is reduced 1%, and t
    15·1 answer
  • It is proposed to use water instead of refrigerant-134a as the working fluid in air-conditioning applications where the minimum
    7·1 answer
  • Consider a variant of the thermostat of example 3.5. In this variant, there is only one temperature threshold, and to avoid chat
    6·2 answers
  • Consider the circuit below where R1 = R4 = 5 Ohms, R2 = R3 = 10 Ohms, Vs1 = 9V, and Vs2 = 6V. Use superposition to solve for the
    15·1 answer
  • Whats the best used for Arch bridge
    11·1 answer
  • Chad is working on a design that uses the pressure of steam to control a valve in order to increase water pressure in showers. W
    10·1 answer
  • The Republican National Committee publishes a monthly digest of information for Republicans called .
    15·1 answer
  • View the picture below and then correctly answer the questions using the following words: Temperate Zone, Tropical Zone, Polar Z
    6·2 answers
  • He is going ___ in the hot air ballon​
    6·1 answer
  • What is the Crankshaft Turk ,Connecting rod Turk and Flywheel Turk for the 5a engine
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!