As discussed in previous lectures, a type declares how an object will be interpreted and used by the
compiler.
Every object in C++ program has a type.
This lecture begins with a broader discussion of fundamental types and then introduce user defined types.
Along the way, you will learn about the several control flow of structures.
So let's get started by fundamental types here.
So fundamental types are the most basic types of object and include integer floating point, character,
boolean, bite size, TX and void.
Here.
So.
Some refer to functional mental types as a primitive or built in types because they are part of the
core language and almost always available to you.
So these types will work on any platform, but their features such as size and memory layout, depend
on the implementation.
So fundamental types strike a balance.
On one hand, they try to map a direct relationship from C++ construct to computer hardware.
So on the other hand, they simplify writing cross-platform code, allowing a programmer to write code
ones that works on many platforms.
The section that follows provide additional detail about these fundamental types.
So let's get started.
Integer with integer types here.
So integer types.
The integer types here.
Let me open the another picture here.
So this is the integer data types.
So integer data type store who numbers that you can write without the fractional component.
The four size of integer types are brought integer.
Unsigned short integer.
Actually, these are the four types here.
I will not count unsigned as a type.
So short integer integer.
Long integer and long long integer.
Of course, all of them has an unsigned type, which I will explain later.
What these inside types are.
So assigned variable here sign variable can be positive.
Negative year or zero.
And the sine variable must be non negative.
As you can see, our typical range from the short integer your starts with a negative number and continues
to positive number, but has the less positive and the less negative.
But if you will use if you want to use only positive numbers, then unsigned integers is for you.
So integers types are signed by signed and integer by default.
As you can see, when you put an integer, create an integer variable, you will create an.
Sign typing to George so you can store both negative and positive numbers.
Take a look at this picture here.
So notice that the integer type size varies across platforms.
For example, 4464 bit Windows and Linux have different size for a long integer four or eight respectively.
So usually a compiler will warn you of a mismatch between format specified and integer type, but you
must ensure that the format specifiers are correct when you are using them in printf statements.
So format specifiers appear here so you can print integers to console in examples.
Follow here.
So let's get started by creating some examples here.
So a literal hardcoded value in program.
Here you can use one of four hardcoded integer literal representations.
Here.
The first is binary binary users, the users, the prefix users, the fix.
Six zero.
Be near.
The octal.
Uses the prefix zero the decimal.
Decimal.
This is default.
And the hexadecimal.
Uses the prefix uses the prefix zero x.
So these are the four different ways of writing the same set of numbers.
For example, I will.
Write some code here.
Which I will show you.
You might assign several integer variables with an integer literal using each of the non decimal representations
here.
So let's get started here.
Let's get an unsigned unsigned short A equals zero B be actual.
Let me.
Just control the idea so you can see what we write here.
So.
A unsigned, unsigned, unsigned integer and unsigned short A equals zero.
B.
Ten.
I will explain all of these courts later, like after we done this.
I will explain this.
Plaintiff.
So you and then new line A.
And then let's create another variable, which is integer.
Integer.
Be zero.
One, two, three.
I will explain this later.
Print F.
The with present operator and new line and we will gave this to be.
And one unsigned.
Long long the.
The r0x as we use the hexadecimal here uses the prefix zero x.
Here, for example, like a.
One, two, three, four, five, six, seven, eight, nine, ten, 11, 12, 13.
Your.
And the princess value as well.
Princess.
You will learn about Formants specifiers as well in later lectures.
Thank you.
And new line.
It's.
Bellevue and New Line of New line and gave this number the right yet the here and then.
We are ready to compile this.
Which I will explain all of this culture here.
She says Our code is compiled without any errors.
Here.
And let's run this quote here.
Oops.
Oh, we have to save this here.
And let's compile code again and again.
Compile within without any errors here.
So as you can see here, the first number is 107.
The second number is 83.
When you convert them to decimal, throw them in decimal arrange.
And the last numbers that we wrote with hexadecimal numbers is like something like that.
This is the decimal point.
Not like any other weird numbers.
So.
The first is binary.
So this program uses each of the non decimal integer representations versus binary.
Second is octal.
And the third is hexadecimal and prints, each with the printf using the appropriate format specified
listed in previous lectures.
So the output from each print period.
Here as you can see here.
So.
Let me pause the video so we can change to the next lecture.
And I'm waiting you in the next lecture.
See you.