Conteúdo do Curso
C++ Introduction
4. Introduction to Program Flow
5. Introduction to Functions
C++ Introduction
Keywords sizeof(), auto and typedef
The size of a variable is the amount of memory reserved by the compiler. The compiler reserves a specific number of bytes from your computer's memory, based on the data type you are using. You can use the sizeof()
function to find out the size of a variable or data type in bytes.
main.cpp
C++ allows you to select a type with a precise bit size, such as int8_t
, uint8_t
, int16_t
,uint16_t
, etc. To use these data types, you will need to include the <cstdint>
header file.
Additionally, we can force the compiler to determine the variable type on its own using the auto
keyword.
main.cpp
C++ also allows you to rename existing data types for yourself. This is what typedef
is used for.
main.cpp
When compiled, the typedef
line tells the compiler that MY_NEW_TYPE
is just a double
type.
Tudo estava claro?
Conteúdo do Curso
C++ Introduction
4. Introduction to Program Flow
5. Introduction to Functions
C++ Introduction
Keywords sizeof(), auto and typedef
The size of a variable is the amount of memory reserved by the compiler. The compiler reserves a specific number of bytes from your computer's memory, based on the data type you are using. You can use the sizeof()
function to find out the size of a variable or data type in bytes.
main.cpp
C++ allows you to select a type with a precise bit size, such as int8_t
, uint8_t
, int16_t
,uint16_t
, etc. To use these data types, you will need to include the <cstdint>
header file.
Additionally, we can force the compiler to determine the variable type on its own using the auto
keyword.
main.cpp
C++ also allows you to rename existing data types for yourself. This is what typedef
is used for.
main.cpp
When compiled, the typedef
line tells the compiler that MY_NEW_TYPE
is just a double
type.
Tudo estava claro?