Type System

A free video tutorial from Dmitri Nesteruk
Software/Hardware Engineering • Quant Finance • Algotrading
22 courses
319,039 students
Lecture description
We discuss the notion of a type system, what it means to work with a statically typed language, and the difference between built-in and user-defined types.
Learn more from the full course
A Complete Introduction to the C++ Programming Language
Learn the C++ programming language with a step-by-step introduction of all the important concepts and language features.
02:46:14 of on-demand video • Updated May 2016
Comfortably write, compile, link and run C++ programs
Solve problems using the C++ programming language
Apply modern C++ programming practices
English [Auto]
In this section of the course we're going to talk about integral types. But first of all we have to talk about the type system generally. So as you can imagine programming language let you stored data in memory and to store that data you can store data of different types of this. You can store whole numbers or you can store decimal numbers or you can sort text or something more complicated like an image for example. Now data is typically stored in variables a variable is basically just a name that you use to refer to some location in memory where the data is actually kept and C++ happens to be what's called a statically typed language. This means that you have to explicitly say what type of data you want to store in a particular variable and you cannot change that variable later. And this is different to the way it's done in dynamic languages where you can assign a variable a number and then assign the same variable a string. You cannot do this in C++ you have to decide what the memory type is in advance and then stick with it until the program is terminated. Now some data types in C++ are built in meaning they're predefined by the programming language. So for example an integer is something that is part of the language so you don't have to make your own or invent your own integer. And of course you can make your own user defined types and in certain situations you will have to do this. So for example we have we have all sorts of integers but we don't have 128 bit integers so if you need something like that that would be a user defined type that you would have to make yourself effectively.