D
D
DoctorGarfield2020-09-29 16:28:18
C++ / C#
DoctorGarfield, 2020-09-29 16:28:18

Why are numbers from -32768 to 32767 stored in two bytes?

I study programming. There is a data type with inta size of two bytes. The numbers will be -32768up to 32767.
How do I calculate that two bytes is that number and for the other 4 bytes, etc.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory, 2020-09-29
@DoctorGarfield

2 bytes = 16 bits. 2^16 = 65536 or -32768 to 32767. Continue by analogy)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question