Dereferencing in C

  Рет қаралды 10,270

CodeVault

CodeVault

Күн бұрын

Dereferencing can be done using either the dereference operator (*) or the array subscript operator ([]). In this video we'll talk about a few quirks regarding these two operators.
Check out our Discord server: / discord

Пікірлер: 33
@sepgh2216
@sepgh2216 8 ай бұрын
As a person who learn programming from top to bottom (I started by Java and was never told about memory) and is new to C this just blew my mind! Amazing explanation! Now everything is starting to make deeper sense.
@doragonmeido
@doragonmeido 2 жыл бұрын
ive always been confused about int* p and int *p and thank you for showing the weird stuffs with array had my mind blown again
@davidjiang7929
@davidjiang7929 3 жыл бұрын
I really like your explanations. Thank you!
@ciprianparaschiv7591
@ciprianparaschiv7591 5 ай бұрын
Great video, I like your style.
@SammanMahmoud
@SammanMahmoud 3 жыл бұрын
Thank you very much for your wonderful videos.... please do not stop :)
@sempercrescere6274
@sempercrescere6274 Жыл бұрын
Great explanation, thank you so much, please continue your great work!
@smwx4
@smwx4 Жыл бұрын
Yea, this is a great explanation, you did a excelent work
@tellsackett4572
@tellsackett4572 Ай бұрын
Thank you!
@mateuspereira214
@mateuspereira214 Жыл бұрын
Thank you sir, that's been really helpful!
@ib1664
@ib1664 4 жыл бұрын
Excellent work on these vids can you please discuss pointers to multidimensional arrays and there relationships to double pointers etc, as well using single loops to iterate through multidimensional arrays. Thanks
@CodeVault
@CodeVault 4 жыл бұрын
I'll make a video on multidimensional arrays next week (as there are multiple ways to go about it).
@krtirtho
@krtirtho 5 ай бұрын
Impressive!
@TrebleWing
@TrebleWing 2 жыл бұрын
Why would they make the symbol (*) so incredibly complicated? It has two different meanings, and both are in the context of pointers. That is just asking to be easily conflated with. Thanks for explaining though. That helped
@navidnouri151
@navidnouri151 2 жыл бұрын
excellent!Thank you!
@mahadifamgate2686
@mahadifamgate2686 3 жыл бұрын
GOOD VIDEO ,,, THANK YOU.
@shaharrefaelshoshany9442
@shaharrefaelshoshany9442 3 жыл бұрын
YOU ARE AMAZING :))
@parisa9374
@parisa9374 2 жыл бұрын
Thank you very much for making these tremendous informative sessions available to everyone. One question? How did you set up your VScode to pop up this "Exception Thrown" window for errors? (@4:24)
@CodeVault
@CodeVault 2 жыл бұрын
What I am using in this video is actually Visual Studio 2019 Community and it's a completely different IDE from Visual Studio Code. It has this expection pop-up function built-in
@parisa9374
@parisa9374 2 жыл бұрын
@@CodeVault I got it. Thanks.
@flywet
@flywet 3 жыл бұрын
As you say at 2:55 , i was confused. What's different when we use int* p and int *p? Btw great tutorial sir
@CodeVault
@CodeVault 3 жыл бұрын
int* p and int *p are exactly the same thing. But, if you do: int* p = &a; *p = 5; The asterisk from "int*" denotes that p is a pointer of type int. But that asterisk from down below denotes a dereference. That's what I meant at that point in the video.
@flywet
@flywet 3 жыл бұрын
@@CodeVault Great, you are very good teacher. That asterisk actually confused me. Now i understand the asterisk use for pointer assignment & dereference are not the same. Thanks
@saybrowt
@saybrowt 9 ай бұрын
I am curious why it is *(arr +1) instead of *(arr + 1 * sizeof(int))
@CodeVault
@CodeVault 7 ай бұрын
Because all operations to pointers are automatically multiplied by the sizeof the data the pointer is pointing to. So: arr + 1 is actually arr + 1 * sizeof(int) inside the compiled code
@saybrowt
@saybrowt 7 ай бұрын
​​@@CodeVault Thank you so much for your clarification and further explanation. To be honest I did not expect a reply on such an old video and least of all from the creator himself, you're awesome for that. What I'm taking away from this is that what I wrote in my original comment is 1) Is valid and correct C code (correct being would work the way as described in the context of the video) and 2) Is what actually is hapenning 'under the hood'
@realdragon
@realdragon 3 жыл бұрын
Now I just want in code to write out of nowhere something like 1[arr] to confuse people
@CodeVault
@CodeVault 3 жыл бұрын
That would be evil :D
@pawanthanay
@pawanthanay 3 жыл бұрын
please explain about char* what does that mean?
@CodeVault
@CodeVault 3 жыл бұрын
It's a pointer to character and, depending on the context, it could represent a string.
@triantafullenia6873
@triantafullenia6873 3 жыл бұрын
what if we had: int * p = a? Is it legall ? If yes what does it mean?
@CodeVault
@CodeVault 3 жыл бұрын
It means you're going to get an error the second you dereference that pointer. int* p = a; This makes p point to whatever is at address 16. But since address 16 is something you don't own and is probably system reserved you'll get a crash.
@triantafullenia6873
@triantafullenia6873 3 жыл бұрын
@@CodeVault OK got it! Thank you very much
@RacecarJ0hnny
@RacecarJ0hnny Жыл бұрын
haha you are kind of cute
Memory manipulation functions in C
10:56
CodeVault
Рет қаралды 54 М.
why do void* pointers even exist?
8:17
Low Level Learning
Рет қаралды 359 М.
He bought this so I can drive too🥹😭 #tiktok #elsarca
00:22
Elsa Arca
Рет қаралды 45 МЛН
Why You Shouldn't Nest Your Code
8:30
CodeAesthetic
Рет қаралды 2,7 МЛН
What are double pointers in C?
14:43
CodeVault
Рет қаралды 43 М.
C Programming: What does Dereferencing a Pointer Mean?
5:26
Master Pointers in C:  10X Your C Coding!
14:12
Dave's Garage
Рет қаралды 304 М.
What are void pointers in C?
10:05
CodeVault
Рет қаралды 29 М.
you will never ask about pointers again after watching this video
8:03
Low Level Learning
Рет қаралды 2,2 МЛН
Why Function Pointers are Awesome
11:11
Jacob Beningo
Рет қаралды 7 М.
Good practice for freeing memory in C
8:17
CodeVault
Рет қаралды 13 М.
Difference between memmove and memcpy
9:15
CodeVault
Рет қаралды 25 М.