1
00:00:02,080 --> 00:00:07,420
So another type of data types.

2
00:00:08,560 --> 00:00:23,650
And that you can see is signed and unsigned now, signed variables can be either positive or negative

3
00:00:23,950 --> 00:00:28,370
because they have one bit reserved for design.

4
00:00:28,390 --> 00:00:35,980
So one of the bids out of the entire structure will be reserved for sign is the most significant bit,

5
00:00:35,980 --> 00:00:37,660
and I'll show you later on.

6
00:00:38,740 --> 00:00:48,760
But an unsigned data type, an unsigned variable, does not have a sign, so therefore the value that

7
00:00:48,760 --> 00:00:51,880
gets stored in it is always positive.

8
00:00:53,500 --> 00:00:58,960
Now, the next data type that we're going to talk about is character.

9
00:01:00,280 --> 00:01:04,690
The character data type will store only individual characters.

10
00:01:04,870 --> 00:01:13,720
When assigning a value to a char variable, you must use single quotes around the character like this.

11
00:01:15,190 --> 00:01:19,150
And the charged data type is still a numeric type.

12
00:01:19,870 --> 00:01:27,790
That means that each character will actually be stored in the computer memory as a number.

13
00:01:28,150 --> 00:01:33,850
The key word for the character data type is char or care.

14
00:01:34,060 --> 00:01:35,560
However you want to call it.

15
00:01:36,040 --> 00:01:42,730
And here you can see how the characters get mapped to the numbers.

16
00:01:43,060 --> 00:01:45,160
And this is the ASCII table.

17
00:01:45,490 --> 00:01:53,110
ASCII stands for American Standard Code for information exchange, and what you want to look for is

18
00:01:53,110 --> 00:01:55,450
the decimal value here.

19
00:01:55,720 --> 00:02:05,260
So if you want to know what lowercase C is in decimal, it's right here.

20
00:02:05,260 --> 00:02:06,520
It's ninety nine.

21
00:02:12,090 --> 00:02:24,300
So for the character data type, we have unsigned and signed versions, so for unsigned char, this

22
00:02:24,300 --> 00:02:27,300
is going to be the key word for it.

23
00:02:27,860 --> 00:02:32,490
And this will also hold only one character at a time.

24
00:02:32,790 --> 00:02:37,680
But it does occupy one bite on most computer systems.

25
00:02:38,760 --> 00:02:50,400
And one by means a bit, so you can see here the lowest value that an unsigned char variable can hold

26
00:02:50,760 --> 00:02:58,950
is all zeros because it doesn't have a sign, all of the bits are used for value.

27
00:02:59,850 --> 00:03:05,040
And then the maximum is when all of the bids are won.

28
00:03:07,820 --> 00:03:14,780
And here you can see the range, it ranges between zero and 255 inclusively.

29
00:03:15,170 --> 00:03:20,540
So for signs, character data type.

30
00:03:20,780 --> 00:03:30,020
This one has a sign and like I was saying before, the most significant bit is used to represent the

31
00:03:30,020 --> 00:03:30,680
sign.

32
00:03:31,040 --> 00:03:35,410
Now, the minimum actually this.

33
00:03:35,420 --> 00:03:38,990
So this also occupies one bite in the computer memory.

34
00:03:39,200 --> 00:03:42,380
So eight bits you have them represented here.

35
00:03:42,650 --> 00:03:50,330
And because this has a sign, one means minus zero means plus.

36
00:03:50,690 --> 00:04:01,130
So the least number that these bits can represent, together with this being a minus is the maximum

37
00:04:01,130 --> 00:04:02,330
of the value.

38
00:04:03,380 --> 00:04:11,720
So all of these value bits will be set to one that yields minus 128.

39
00:04:12,200 --> 00:04:18,860
And then the maximum value in this case, the sign will be plus.

40
00:04:19,190 --> 00:04:28,700
And then the maximum of these like value bits, which are still one, and that will be one twenty seven.

41
00:04:28,910 --> 00:04:41,300
So that is the range and the the way to know if your char is signed is that there's no one sign in front

42
00:04:41,300 --> 00:04:41,960
of it here.

43
00:04:43,740 --> 00:04:44,430
So.

44
00:04:48,820 --> 00:04:52,870
Another data type very important is an integer.

45
00:04:53,110 --> 00:05:04,390
So the integer can only hold hold numbers and unsigned integers will only hold a positive whole number.

46
00:05:04,930 --> 00:05:12,040
Meanwhile, signed integers can hold either a positive whole number or a negative one.

47
00:05:13,300 --> 00:05:24,640
So here you can see that the unsigned integer occupies four bytes in computer memory now.

48
00:05:24,640 --> 00:05:28,630
So that is 32 bits and you can see it here.

49
00:05:30,310 --> 00:05:36,970
In the case that we're talking about the minimum value that an unsigned end can have.

50
00:05:37,450 --> 00:05:46,270
It is all zeros because there is no sign and all of the 32 bits are used for value.

51
00:05:47,170 --> 00:05:57,010
So in this case, zero is the lowest value in the range that an unsigned in can hold now for the maximum,

52
00:05:57,010 --> 00:06:00,430
and they're going to be all one, and that yields four million.

53
00:06:00,580 --> 00:06:08,380
Now four million two hundred ninety four million nine hundred sixty seven thousand two hundred ninety

54
00:06:08,380 --> 00:06:08,830
five.

55
00:06:09,400 --> 00:06:12,100
So this is the range.

56
00:06:13,840 --> 00:06:17,210
And unsigned and is the key word for it.

57
00:06:17,560 --> 00:06:28,900
And this unsigned INT data type can only hold all numbers in between this range right here.

58
00:06:29,590 --> 00:06:33,130
No more and no negatives, for sure.

59
00:06:33,490 --> 00:06:40,900
And here is an example if you want to create a variable of type unsigned int.

60
00:06:42,130 --> 00:06:43,420
This is how you do it.

61
00:06:44,660 --> 00:06:50,540
So far, it is signed, and now this one does have a sign.

62
00:06:50,900 --> 00:07:00,920
And the most significant bit here will be the sign in the case of the minimum, because this also has

63
00:07:00,920 --> 00:07:03,440
four bites, so this will be thirty two bids.

64
00:07:05,180 --> 00:07:14,360
In the case of the minimum, this sign will be a minus and then we want the maximum value of the rest

65
00:07:14,360 --> 00:07:20,090
of the bids, which actually are going to be all used for value, except for this one.

66
00:07:20,930 --> 00:07:23,930
And that will be this number here.

67
00:07:25,180 --> 00:07:31,840
And then for the maximum, we want a plus and then the maximum value we can get out of the rest of the

68
00:07:31,840 --> 00:07:38,860
bits which are used for value, so that yields to this number here.

69
00:07:40,030 --> 00:07:43,720
And the key word for assigned integer is int.

70
00:07:44,260 --> 00:07:50,800
And this is an example of how you can create a variable of type signed end.

71
00:07:51,880 --> 00:07:57,130
So another data type that I want to talk about is a float.

72
00:07:57,490 --> 00:08:06,130
So a float is used to define variables that can hold real numbers of fractions, right?

73
00:08:07,930 --> 00:08:14,950
Float is considered single precision because it can hold up to seven decimal places.

74
00:08:15,160 --> 00:08:18,580
It still has a size of four bytes.

75
00:08:18,910 --> 00:08:22,480
And this is the key word for it float.

76
00:08:23,200 --> 00:08:24,520
Here's an example.

77
00:08:25,940 --> 00:08:33,470
So you'll be using this if you need to store a number that has maximum seven decimal places.

78
00:08:34,910 --> 00:08:42,320
Otherwise, the rest of them will just not be stored if it has, let's say, eight.

79
00:08:43,350 --> 00:08:50,940
Decimal places, the number that you're trying to store, it will just be like rounded up or down,

80
00:08:50,940 --> 00:08:58,110
depending on if it's five or under or five or more.

81
00:08:59,310 --> 00:09:10,080
And one very important thing to mention about floating a float is that there are no unsigned floating

82
00:09:10,080 --> 00:09:16,050
point data types so it can hold either negative or positive numbers.

83
00:09:17,430 --> 00:09:26,700
And double is like floats bigger brother because it basically does the whole thing, but it does have

84
00:09:26,700 --> 00:09:27,930
double precision.

85
00:09:28,230 --> 00:09:37,470
So that means that it can hold up to 15 decimal places and it has a size of eight bytes, so it's double

86
00:09:37,470 --> 00:09:38,370
in size.

87
00:09:38,640 --> 00:09:40,500
Key word for this is double.

88
00:09:40,740 --> 00:09:52,170
So one thing to to keep in mind here, too, is that there are no unsigned floating point data types

89
00:09:52,800 --> 00:09:53,820
like for a float.

90
00:09:54,240 --> 00:09:58,040
And this is still considered a floating point data type.

91
00:09:58,050 --> 00:10:06,360
So double and float definitely are kind of the same thing, but more precision and one less another.

92
00:10:06,750 --> 00:10:16,230
Now, with that being said, we've talked about a lot of things in this lecture, but take it all with

93
00:10:16,230 --> 00:10:24,660
a grain of salt just because the sizes and ranges may be different on your operating system.

94
00:10:24,960 --> 00:10:36,150
The all of the sizes that we've talked about it are actually only specific to most operating systems,

95
00:10:36,660 --> 00:10:37,500
so.

96
00:10:39,120 --> 00:10:49,230
What you can do to actually find your design is that your variables or your data types occupy on your

97
00:10:49,230 --> 00:10:58,650
computer system is to use the C plus plus size of operator to find the size that a variable occupies

98
00:10:58,650 --> 00:10:59,490
in memory.

99
00:10:59,850 --> 00:11:10,260
So, for example, if we have an INT variable called value that we assign tend to here doesn't even

100
00:11:10,260 --> 00:11:14,340
matter if we've assigned a value to it yet or not.

101
00:11:14,340 --> 00:11:23,730
If the variable is defined, we can use this statement see out size of value to print the number of

102
00:11:23,730 --> 00:11:27,930
bytes, then the variable occupies in memory so.

103
00:11:29,420 --> 00:11:35,180
Hopefully, you had a lot of fun watching this, this lecture.

104
00:11:35,300 --> 00:11:40,970
We did talk about quite a few things today, so let us know if you have any questions.

105
00:11:42,200 --> 00:11:43,970
And see you in the next lecture.
