From the course: Learning C++
Unlock the full course today
Join today to access over 25,200 courses taught by industry experts.
Basic data types - C++ Tutorial
From the course: Learning C++
Basic data types
- [Instructor] As with any programming language, it's essential to know the supported data types. C++ supports a very basic set of data types. Let's start with integers. Integer numbers may be signed or unsigned. There are several integer types in C++. There's the int type with a bit length that's implementation dependent. Usually it's 32 bits, but it's sometimes 16 bits. We also have the char type, which is short for character. It's eight bits wide, and it was designed to represent ASCII characters, but it's just a bite. You may use it as an integer if you want. Because these types may vary in length and sign, a very useful C library called stdint.h contains portable data types that specify the length and sign support of their types. For example, uint32_t is an unsigned 32 bit integer, and int8_t is a signed eight bit integer. C++ also supports floating-point numbers. Floating-point numbers represent real numbers as…
Contents
-
-
-
-
(Locked)
Basic data types3m 44s
-
Variables2m 6s
-
(Locked)
Using variables5m 18s
-
Expressions, assignments, and operations3m 52s
-
(Locked)
Type inference with auto3m 5s
-
(Locked)
Preprocessor directives7m 10s
-
(Locked)
Constants1m 58s
-
Arrays6m 44s
-
(Locked)
Strings5m 42s
-
(Locked)
Type casting4m 34s
-
(Locked)
Type casting examples5m 13s
-
(Locked)
Enumerations7m 55s
-
(Locked)
Challenge: Calculate an average57s
-
(Locked)
Solution: Calculate an average54s
-
(Locked)
-
-
-
-
-