Shadowing Practice: you will never ask about pointers again after watching this video - Learn English Speaking with Video

Kies een oefenmodus

Elke modus opent een volledig scherm oefenruimte.

103 zinnen
Als zinnen te kort of te lang zijn, klik op Bewerken om ze aan te passen.
1
One of the hardest things for new programmers to learn is pointers.
2
Whether it's pointers by themselves, pointers that point to arrays, or pointers that point to pointers, Something about this concept just drives people crazy.
3
And if you're a new programmer, well, you're not alone.
4
I was one of those people when I learned C back in the day, and like you, I was eager to understand.
5
In this video, I'll show you what a pointer is so you can fully understand how they work, the syntax of pointers so you can easily read them,
6
and finally, why everyone cares so much about pointers and what they're used for.
7
Before we start, if you're new here, hit that subscribe button and while you're at it leave a like.
8
I put out videos demystifying topics like this and much more on a weekly basis.
9
What is a pointer?
10
The question that's been asked since the beginning of time.
11
well, maybe not that long, but computer science students have been asking this question for a while.
12
Pointers are not that complicated, and let me show you why.
13
To understand what a pointer is, we need to first understand how memory works.
14
So here I've laid out an example of memory.
15
Memory in our example has two features: an address, and a value.
16
The address is the location of the memory, meaning where that memory lives.
17
And the value of that memory is the data stored at that location, meaning what memory lives there.
18
So for example, if I put a four here, What does that mean?
19
All that means is that the value 4 lives at location hex 1000.
20
Easy.
21
And the notation in C, for example, may be int x equals four, which gets allocated to that memory on the stack, and now that number lives there.
22
So what happens now if at another location I put the number hex 1000 at address hex 1004?
23
I've just created a pointer.
24
You may be thinking, low level learning, how is this possible?
25
That's just a number at a location.
26
Well guys, that's the secret.
27
A pointer is just a value that happens to be an address.
28
Mind blown.
29
By setting the value of one variable equal to the address of another, that variable now points to the other.
30
For new programmers, though, most of the time, that isn't as easy as it seems.
31
One of the most common issues new programmers have with pointers is the syntax used to create them.
32
The combination of stars and ampersands and arrows and more stars creates a lot of confusion, so let's break this down using our previous example.
33
In our last example, we made an integer x whose value was 4 at location hex 1000.
34
After that, we made a pointer that lived at address hex 1004, whose value was $1000.
35
So how do we do that in C?
36
We can do that using two lines of code, and I'll break them down part by part.
37
The first line is int x equals four.
38
This line is pretty straightforward.
39
The first part, integer, is the type of the variable, which is 4 bytes wide, and this will matter later in the video.
40
The second part is the name.
41
Nothing special here, just the variable name x.
42
And then after that, we put an equal sign, which when describing C, we can verbalize the equal sign to is C set to.
43
Finally, the value 4.
44
So the final sentence we've come up with is, Integer whose name is X is set to the value 4.
45
Okay.
46
Easy part over, next is the hard part.
47
To make a pointer to x like we did in our example, I would say the following line of C: int *px is equal to ampersand x.
48
Now I know that sounds pretty crazy, a little scary, Let's break it down piece by piece.
49
From left to right, we can see the type again, starting with int.
50
But next we see the dreaded Asterisk.
51
What does that mean?
52
When an asterisk is placed next to a type, it modifies the type, meaning that our variable is now a pointer to an integer.
53
So our variable here points to a four byte value.
54
Next, the variable's name which is Px or pointer to x, You can name it whatever you want, but this is a good habit using "P" to denote that it's a pointer.
55
and then after that are equal sign, which again means is set to.
56
Ah, and then the next dreaded character, the Ampersand.
57
Whenever you see an ampersand just think in your head the address of.
58
So this means the address of x.
59
Our final sentence here is, Int pointer.
60
P X is set to the address of X.
61
So, what does this do for us?
62
Well now by using the pointer, we have a way of accessing x by reference instead of by value.
63
So for example, if we wanted to copy the value of x to a new variable using that pointer, we could do that pretty easily with this new bit of code.
64
We'll say that int y equals *px.
65
Now what is this code doing?
66
Let's break it down.
67
Again, y, just like x, is a normal integer, so no pointers yet.
68
We say that Y is set to, using that equal sign, uh oh, the asterisk again.
69
Remember how last time I said when we see an asterisk, it's used to modify a type if a type is near it?
70
Well, here there is no type.
71
When it's used alone this way, the asterisk is referred to as a "d" reference.
72
The dereference means go to the address pointed to by the pointer and grab that value.
73
So, because px points to x, The dereference will go and grab that value and it will set Y equal to x.
74
So when reverbalizing C, when you see an asterisk by itself, you can say "the thing pointed to by."
75
This would mean that the final verbalization of this line of C is
76
integer y is set to the thing pointed to by p x.
77
By doing this, we can pass around X by reference instead of value.
78
And why that matters, I'll explain in the next part of the video.
79
The final concept that could use people the most when learning about pointers is why does anyone use them?
80
The syntax is confusing, my programs crash all the time when I use them, why does anyone bother?
81
Well, the answer is because we have to.
82
To avoid making code that is impossible to read or unscalable, we break down functions based on the action that they perform,
83
So here I have a small snippet of C where I have a function that updates the age of a person structure.
84
The problem is that the structure I'm editing is not in scope of the editing function.
85
To get around this, we pass the struct by reference so that now the pointer to the structure
86
is in scope of update struct and can therefore be edited.
87
Using pointers like this keeps our code clean and understandable while reducing the amount of space that we use by not copying.
88
Another reason that pointers are inevitable when coding in C is the idea of using static versus dynamic memory allocation.
89
static allocation is typically a variable that goes onto the stack, a place that is always in scope for the function that is running it.
90
However, when you're using dynamic allocations that come from the heap through malloc or sbreak or other kinds of memory allocators,
91
you are going to get a pointer to memory that is out of scope.
92
If you ever want to be able to use this kind of memory, you need to know how pointers work.
93
The primary difference between dynamic and static allocations is
94
that static allocations are things
95
that are known to have a fixed size at compile time
96
whereas dynamic allocations can be changed in size as the program runs.
97
Here you see I allocate a string of 100 bytes to be pulled from the heap
98
But that 100 bytes could have come from a user input or something else.
99
If you're having a hard time with C, don't be discouraged.
100
Pointers do take a minute to master, but once you get them, you'll know it and you'll feel like a real low level wizard when you do.
101
Guys, I had a fun time making this video.
102
If you enjoyed this, do me a favor, hit like, hit subscribe, and I'll see you next week.
103
Take care.

App downloaden

Alles wat je nodig hebt om vloeiend te spreken

AI UitspraakScoor elke zin
IPA OefeningBeheers elk geluid
WoordenschatBouw je woordenschat op
WoordenspelLeren terwijl je speelt

Zelfde Kanaal

FOR YOU

Aanbevolen Video

Woordenschat en spreektips bij deze les

Deze video bevat 103 zinnen en 1434 woorden om na te spreken. Het gesproken deel duurt 7:59. De spreker praat snel, ongeveer 180 woorden per minuut, dus reken op verbonden en ingeslikte klanken. Slechts 81% van de woorden hoort bij de 3.000 meest gebruikte Engelse woorden, dus de woordenschat is pittig.

Belangrijke woorden in deze video

15 minder gangbare woorden uit de video, met uitspraak en betekenis:

  • variable [ˈvæɹ.i.ə.bl̩] (bijvoeglijk naamwoord) — veranderlijk, variabel. Able to vary or be varied.
  • allocation /ˌæl.əˈkeɪ.ʃən/ (zelfstandig naamwoord) — allocatie, toewijzing. The process or procedure for allocating things, especially money or other resources.
  • dynamic /daɪˈnæm.ɪk/ (bijvoeglijk naamwoord) — dynamisch, veranderlijk. Changing; active; in motion.
  • scope /skəʊp/ (zelfstandig naamwoord) — domein, bereik. The breadth, depth or reach of a subject; the extent of applicability or relevance; a domain, purview or remit.
  • programmer /ˈpɹoʊɡɹæmɚ/ (zelfstandig naamwoord) — programmeur. One who writes computer programs.
  • edit /ˈɛdɪt/ (werkwoord) — bewerken, wijzigen. To change a text, or a document.
  • syntax /ˈsɪn.tæks/ (zelfstandig naamwoord) — syntaxis. A set of rules that govern how words are combined to form phrases and sentences.
  • stack /stæk/ (zelfstandig naamwoord) — stapel. A large pile of hay, grain, straw, or the like, larger at the bottom than the top, sometimes covered with thatch.
  • subscribe /səbˈskɹaɪb/ (werkwoord) — abonneren. To write (one’s name) at the bottom of a document; to sign (one's name).
  • modify /ˈmɑ.dɪˌfaɪ/ (werkwoord) — modificeren, veranderen. To change part of.
  • dread /dɹɛd/ (zelfstandig naamwoord) — vrees, doodsangst. Great fear in view of impending evil; fearful apprehension of danger; anticipatory terror.
  • topic /ˈtɑpɪk/ (zelfstandig naamwoord) — onderwerp, thema. A subject; a theme; a category or general area of interest.
  • complicated /ˈkɑm.plɪˌkeɪ.tɪd/ (bijvoeglijk naamwoord) — ingewikkeld, gecompliceerd. Difficult or convoluted.
  • refer /ɹɪˈfɜː/ (werkwoord) — verwijzen, doorverwijzen. To direct the attention of (someone toward something).
  • whereas /(h)wɛɹˈæz/ — hoewel, terwijl. In contrast; whilst on the contrary; although.

Phrasal verbs die je zult horen

  • break down (werkwoord) — stukgaan, kapot gaan. To stop functioning.
  • come up with (werkwoord) — bedenken, verzinnen. To manage to produce, deliver, or present (something) by inventing, creating, thinking of, or obtaining it.
  • put out (werkwoord) — buitenzetten, uitwerpen. To blind (eyes).

Uitspraak om op te letten

De spreker gebruikt 20 samentrekkingen en verkorte vormen, zoals you're, I'll, I've. Spreek ze kort uit, zoals je ze hoort.

  • De klanken “sh” en “zh”: allocation /ˌæl.əˈkeɪ.ʃən/, confusion /kənˈfjuːʒən/, notation /noʊˈteɪʃən/
  • Lange woorden — let op de klemtoon: allocation /ˌæl.əˈkeɪ.ʃən/, complicated /ˈkɑm.plɪˌkeɪ.tɪd/, inevitable /ɪˈnɛvɪtəbəl/, allocator /ˈæl.ə.keɪ.tə/, demystify /diːˈmɪstɪfaɪ/

Zo oefen je met deze video

  1. Luister de hele video één keer zonder te spreken en noteer de woorden die je niet kent.
  2. Begin op 0,75× snelheid, spreek zin voor zin na en ga terug naar normale snelheid zodra het makkelijk gaat.
  3. Neem jezelf op en vergelijk met het origineel; let daarbij op woorden als variable, allocation, dynamic.

Grammatica in deze video

De structuren die de spreker het meest gebruikt, met de exacte woorden uit de video:

StructuurIn de video
Lijdende vorm be + voltooid deelwoord — het gaat om wat er gebeurt, niet om wie het doetbeen asked · is set · is placed
Present perfect have/has + voltooid deelwoord — iets uit het verleden dat nu nog teltthat's been asked · I've laid · I've just created
Betrekkelijke bijzinnen who / which + zin — extra informatie over een persoon of dingvariable, which is · name which is

Wat is de Shadowing-techniek?

Shadowing is een wetenschappelijk onderbouwde taalleermethode die oorspronkelijk is ontwikkeld voor professionele tolkentraining en gepopulariseerd door polyglot Dr. Alexander Arguelles. De methode is eenvoudig maar krachtig: je luistert naar native Engelse audio en herhaalt het onmiddellijk hardop — als een schaduw die de spreker volgt met slechts 1–2 seconden vertraging. In tegenstelling tot passief luisteren of grammaticadrills, dwingt shadowing je hersenen en mondspieren om echte spraakpatronen tegelijkertijd te verwerken en te reproduceren. Onderzoek toont aan dat het de uitspraaknauwkeurigheid, intonatie, ritme, verbonden spraak, luisterbegrip en spreekvaardigheid aanzienlijk verbetert — waardoor het een van de meest effectieve methoden is voor IELTS Speaking-voorbereiding en echte Engelse communicatie.

Shadowing-techniek: lees de volledige stap-voor-stap-gids →