Technische Informatik; Hardwarenahe Programmierung

Datentypen

Inhalt

Beispiel uint8_t

uint8_t in Hederdatei <inttypes.h> oder bei MSVC <stdint.h>

uunsigned (also nur positive Zahlen, keine negativen)
uintunsigned int (also nur ganze positive Zahlen)
uint8mit 8 Bit (also: 0 bis 255 ist char)
uint8_tdas _t steht für: mit typedef definierter Aliasname für einen Datentyp (hier für unsigned char).

Datentypen in C++

TypeKeywordBytesRange
characterchar1-128 .. 127
unsigned characterunsigned char10 .. 255
integerint2-32 768 .. 32 767
short integershort2-32 768 .. 32 767
long integerlong4-2 147 483 648 .. 2 147 483 647
unsigned integerunsigned int20 .. 65 535
unsigned short integerunsigned short20 .. 65 535
unsigned long integerunsigned long40 .. 4 294 967 295
single-precision floating-point (7 Stellen)float41.17E-38 .. 3.4E38
double-precision floating-point (19 Stellen)double82.2E-308 .. 1.8E308

Typedef definierte Alias

KeywordBytesRangeC-Entsprechung (gcc)
int8_t1−128 .. 127signed char
int16_t2−32768 .. 32767signed short, signed int
int32_t4−2147483648 .. 2147483647signed long
int64_t8−9223372036854775808 .. 9223372036854775807signed long long
KeywordBytesRangeC-Entsprechung (gcc)
uint8_t10 ..255unsigned char
uint16_t20 .. 65535unsigned short, unsigned int
uint32_t40 .. 4294967295unsigned long
uint64_t80 .. 18446744073709551615unsigned long long

Printf Spezifizierer

CharacterTypeOutput format
C, cinta single-byte character
dintSigned decimal integer.
iintSigned decimal integer.
ointUnsigned octal integer.
uintUnsigned decimal integer.
X, xintUnsigned hexadecimal integer
E, e, f, G, gdoubleSigned value; form [–]d.dddd e [-]dd[d]
pPointerPrints the address of the argument in hex.
S, sStringspecifies a single-byte–character string.

All wikipages