Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Einen Typ Angeben | Einführung
C++ Datentypen

bookEinen Typ Angeben

Being a typed language means that you must declare the type of a variable when you initialize it. To specify the data type for the variable you have to use the following syntax:

By specifying the variable's data type, we inform the computer about the amount of memory needed to store its value and how to interpret that value.

What actually happens when we create a variable of some type

Let's look at the example of an int data type. As you will see in the next section, it requires 4 bytes (=32 bits) of data to hold its value. So, the computer must allocate 4 bytes of memory for storing this value.

The computer allocates 4 cells (bytes) of memory for the num variable. When we assign the value to a num, those cells will hold this value. Also, there is a memory address associated with the cells.

Values are stored in memory using a binary number system (sequence of 1s and 0s). So the numbers are being converted to a binary system first. The following video shows how the value of 1231 is stored in memory.

1. What does it mean for a language to be typed?

2. Which of the following is true about memory addresses?

question mark

What does it mean for a language to be typed?

Select the correct answer

question mark

Which of the following is true about memory addresses?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 5

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

bookEinen Typ Angeben

Swipe um das Menü anzuzeigen

Being a typed language means that you must declare the type of a variable when you initialize it. To specify the data type for the variable you have to use the following syntax:

By specifying the variable's data type, we inform the computer about the amount of memory needed to store its value and how to interpret that value.

What actually happens when we create a variable of some type

Let's look at the example of an int data type. As you will see in the next section, it requires 4 bytes (=32 bits) of data to hold its value. So, the computer must allocate 4 bytes of memory for storing this value.

The computer allocates 4 cells (bytes) of memory for the num variable. When we assign the value to a num, those cells will hold this value. Also, there is a memory address associated with the cells.

Values are stored in memory using a binary number system (sequence of 1s and 0s). So the numbers are being converted to a binary system first. The following video shows how the value of 1231 is stored in memory.

1. What does it mean for a language to be typed?

2. Which of the following is true about memory addresses?

question mark

What does it mean for a language to be typed?

Select the correct answer

question mark

Which of the following is true about memory addresses?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 5
some-alt