Data types

Posted On
Socialize It →
0
Bytes can represent either integer or floating point numbers, images, sounds, texts, programs, etc. We call type the semantic associated to a group of bytes. For example, a byte alone can carry 256 = 28 different values. Depending on how we consider it, it can represent either an integer value between 0 and 255,
or an integer value between −128 and +127, or a character (in that case we use a table to define the correspondence between the bit configurations and the characters). It could also be considered as two integers between 0 and 15. 

Bytes can be grouped, for example to represent larger integers. The standard integer in C++ on a x86 processor is composed with 4 bytes, thus 32 bits, and can encode a value between −2147483648 and 2147483647. The address of a byte in the memory is itself an integer, and can also be repre-
sented in the memory. Because of the binary representation, the most convenient notation for memory address is in hexadecimal, i.e. base 16. In this base, the digits are {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f}, and each of them represents 4 bits. For example 26 = 16 + 10 will be denoted 1a in hexadecimal.

0 comments:

Post a Comment

'