Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Keywords sizeof(), auto and typedef | Variables and Data Types
course content

Зміст курсу

C++ Introduction

Keywords sizeof(), auto and typedefKeywords 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.

cpp

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.

cpp

main.cpp

C++ also allows you to rename existing data types for yourself. This is what typedef is used for.

cpp

main.cpp

When compiled, the typedef line tells the compiler that MY_NEW_TYPE is just a double type.

Все було зрозуміло?

Секція 2. Розділ 6
course content

Зміст курсу

C++ Introduction

Keywords sizeof(), auto and typedefKeywords 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.

cpp

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.

cpp

main.cpp

C++ also allows you to rename existing data types for yourself. This is what typedef is used for.

cpp

main.cpp

When compiled, the typedef line tells the compiler that MY_NEW_TYPE is just a double type.

Все було зрозуміло?

Секція 2. Розділ 6
some-alt