Basic Types and their use in C++
While programming we need to use different type of information and for each single class of data that we want to produce or to store there is a Data Type in a programming language. One basic principle to understand is that storing a letter is different from storing a number, or a decimal or a word, o a set of numbers. For all this types of data C++ has a way to store them in memory and perform transformations to the values. Those places are called variables and a variables is nothing weird, it’s just a place in memory where the programm saves something (say a word, or a single letter, or a number, etc).
While programming we need to use different type of information and for each single class of data that we want to produce or to store there is a Data Type in a programming language. One basic principle to understand is that storing a letter is different from storing a number, or a decimal or a word, o a set of numbers. For all this types of data C++ has a way to store them in memory and perform transformations to the values. Those places are called variables and a variables is nothing weird, it’s just a place in memory where the programm saves something (say a word, or a single letter, or a number, etc).
The following table presents the types and how they are called in C++
Type | Keyword |
---|---|
Boolean | bool |
Character | char |
Integer | int |
Floating point | float |
Double floating point | double |
Valueless | void |
Wide character | wchar_t |
It’s interesting that you can modify some of this types by ading words like signed, unsigned, short and long. For example: unsigned int is a variable that can only store interger with no sign thus, only positive intergers.
In the next video I will explain the use of 2 data types:
char and bool.
Mastery09 by Octavio Rojas is licensed under a Creative Commons Attribution 4.0 International License.