1 00:00:02,650 --> 00:00:10,220 Using no pointer, so a pointer could point to anywhere in the memory installed on your computer. 2 00:00:10,240 --> 00:00:15,940 So and then assignment that the reference pointer means that you could potentially write over since 3 00:00:15,940 --> 00:00:24,220 the memory used by operating systems so or write memory used by hardware on your machine. 4 00:00:24,220 --> 00:00:31,030 However, the operating systems will usually give an executable a specific memory range that it can 5 00:00:31,030 --> 00:00:34,000 access, and it tends to access memory. 6 00:00:34,000 --> 00:00:42,730 And if it attempts to access memory out of this range, it will cause an operating system memory access 7 00:00:42,730 --> 00:00:43,890 violation. 8 00:00:43,900 --> 00:00:53,560 So for this reason, you should almost always obtain pointer values using the end operator here or from 9 00:00:53,560 --> 00:00:55,990 a call to an operating system function. 10 00:00:55,990 --> 00:00:59,880 So you should not give a pointer, an absolute address. 11 00:00:59,890 --> 00:01:06,190 The only exception to this is the C++ constant for invalid memory address. 12 00:01:06,190 --> 00:01:07,540 No TR here. 13 00:01:07,540 --> 00:01:09,730 So for example, let's define the point here. 14 00:01:10,570 --> 00:01:15,700 Let's define the P pointer here and assign it as new beta. 15 00:01:15,880 --> 00:01:21,100 Here you add the code and integer A 62. 16 00:01:21,960 --> 00:01:24,510 And then assign p. 17 00:01:25,920 --> 00:01:31,260 R a variable, a integer variable here and called here as well. 18 00:01:32,090 --> 00:01:34,040 For example, just an example code. 19 00:01:34,220 --> 00:01:36,290 We won't write it in this lecture here. 20 00:01:36,620 --> 00:01:44,240 So if our new Peter not equals to P, then. 21 00:01:45,420 --> 00:01:48,180 See out STD. 22 00:01:49,620 --> 00:01:50,270 Here. 23 00:01:50,310 --> 00:01:52,560 See out here. 24 00:01:53,310 --> 00:01:54,090 And. 25 00:01:55,210 --> 00:02:00,850 P list asterisk here and and here. 26 00:02:01,870 --> 00:02:03,370 So this code. 27 00:02:03,400 --> 00:02:09,840 Initialize the pointer pointer P to null Peter. 28 00:02:10,600 --> 00:02:12,590 We get an error here and line. 29 00:02:12,610 --> 00:02:13,180 Yes. 30 00:02:13,720 --> 00:02:18,310 So this code initialized p to new Peter later in the code. 31 00:02:18,760 --> 00:02:23,530 The pointer is initialized to the address of an integer variable. 32 00:02:24,160 --> 00:02:30,510 So still later in the code, the pointer is used by the rather than calling it immediately. 33 00:02:30,520 --> 00:02:37,740 So the pointer is first check to ensure that it has been initialized to a non null value. 34 00:02:37,750 --> 00:02:44,520 So the compiler will check to see if we are able to use a variable that has not been initialized. 35 00:02:44,530 --> 00:02:51,340 But if you're writing library code, the compiler will not know whether the colors of your code will 36 00:02:51,340 --> 00:02:53,780 use pointers correctly. 37 00:02:53,800 --> 00:02:56,360 So the type here type of constant. 38 00:02:56,360 --> 00:02:59,120 No, Peter is not an integer. 39 00:02:59,140 --> 00:03:01,780 It is here sdd. 40 00:03:02,950 --> 00:03:11,080 No p t r t variable, so all pointers type can be implicitly converted to this type. 41 00:03:11,380 --> 00:03:18,160 So no p t r can be used to initialize variables of all pointer types.