Type Systems

Learn about type systems in modern programming languages.

Variable types

It is a common practice to use the static type system in compiled programming languages, such as C. When using this system, we decide how to store the variable in memory. We should specify the variable type when declaring it. Then, the compiler allocates memory and picks one of the predefined formats to store this type of variable.

Here is an example of how the static type system works. Let’s suppose we want to declare a variable called number. We should specify its type in the declaration. We choose the unsigned integer type, which has a size of two bytes. Then, the compiler allocates exactly two bytes of memory for this variable.

Get hands-on with 1400+ tech skills courses.