Very cool video, thanks!! There is a small mistake (typo?) at 7:40 It should be `*(array1 + 1)` instead of `(*array1 + 1)` if you want to increase the pointer. Your version dereferences the array first to be "1" and than just adds to that. In your case this works by accident because the array values also increase by 1. If your array was [10, 20, 30, 40} it would print "10, 11, 12, 13" ;)
Man this is very Cool I am an undergrad in Software engineering and i can assure you this UA-cam project is very informative and its gonna grow exponentially
Hey, great video. Made some things clearer, although I already learned most of this stuff the hard way and understand the idea behind it. I really liked the smooth animations! There were a few moments which I understood because I already knew what you were talking about, but I felt like it might've been a bit confusing for beginners. Also note that some of the inserted clips felt out of place, I remember one of them was cut out too early and the other was way too loud (yes, the explosion). All in all, I enjoyed these 20 minutes and definitely would recommend this video to anyone who is having trouble understanding pointers.
Great video, although I had to pause and replay so many parts. Advice: try to change the visuals right when you change the audio when you're jumping from one thing to another, it would make the video easier to watch and understand!
@10:53 its actually best practice to check if a pointer is == to NULL || nullptr because dereferencing a nullptr causes a crash. the malloc function doesnt "return NULL if the allocation fails" it only ever returns void* which is why u can cast it to a pointer to any type in the first place.
Why did I get a segmentation fault then? Not saying you're wrong, but gcc will give me a Segmentation Fault if I attempt to dereference a null pointer. As for it returning void, not sure if thats true, but it does indeed become of value NULL, because it a becomes a pointer pointing to nothing, and a pointer without a valid address is a value of NULL.
You deleted your comment, but you were right about one thing, malloc can return a void pointer type if your allocation fails for a reason other then insufficient memory, no need to get hostile, I'm not afraid of being wrong
@@ProjectXiel thank you for acknowledging Also animations that show the data going to and from the memory and not just the code would be helpful for beginners I'm a very visual person and until I had all the stuff visualized and animated in my head did I begin to understand the very simple concepts of pointers that have been greatly exaggerated due to overly technical terminology and referring to the syntax of C, which is quite poor but when compared to assembly is like a panacea
I have some recommendations Xiel: The Art of Software Engineering The Art of Operating Systems The Art of Compilers The Art of Front-End Development The Art of Databases The Art of Data Structures The Art of Algorithms
Don't overcomplicate it, if you understand what an array is then it should be kinda simple. Basically you have bunch of memory addresses, each one able to hold 1 byte of data, so 1 index will be 4 memory adresses, incrementing the pointer will go forward 4 addresses or 1 depending on the data type, thats all indexing is. The array is a pointer to start of the memory block (the first index). Thats basically it, instead of declaring 1 variable you're declaring multiple variables at the same time basically. malloc, calloc, and realloc, are basically giving you the ability to allocate, deallocate and resize memory freely, the compiler handles the statically allocated memory (normal arrays), but you handle the dynamically allocated memory. The syntax for dynamic memory alloction does look kinda confusing, but I think I did an ok job at explaining. idk I tried
Very cool video, thanks!!
There is a small mistake (typo?) at 7:40
It should be `*(array1 + 1)` instead of `(*array1 + 1)` if you want to increase the pointer.
Your version dereferences the array first to be "1" and than just adds to that. In your case this works by accident because the array values also increase by 1.
If your array was [10, 20, 30, 40} it would print "10, 11, 12, 13" ;)
int array1[6] = {1,2,3,4,5,6};
int n = sizeof(array1)/sizeof(array1[0]);
cout
I genuinely just didn't realize the mistake bc I got the correct output
okay maybe not huge, but still embarrassing nonetheless, thank you for pointing it out though.
Man this is very Cool I am an undergrad in Software engineering and i can assure you this UA-cam project is very informative and its gonna grow exponentially
Hey, great video. Made some things clearer, although I already learned most of this stuff the hard way and understand the idea behind it. I really liked the smooth animations! There were a few moments which I understood because I already knew what you were talking about, but I felt like it might've been a bit confusing for beginners. Also note that some of the inserted clips felt out of place, I remember one of them was cut out too early and the other was way too loud (yes, the explosion). All in all, I enjoyed these 20 minutes and definitely would recommend this video to anyone who is having trouble understanding pointers.
Thanks for the feedback I'll keep it in mind
I love C. I adore C. It's the best thing, it's just SO fun and expressive...
Great video, although I had to pause and replay so many parts.
Advice: try to change the visuals right when you change the audio when you're jumping from one thing to another, it would make the video easier to watch and understand!
I'll keep that in mind!
@10:53 its actually best practice to check if a pointer is == to NULL || nullptr because dereferencing a nullptr causes a crash. the malloc function doesnt "return NULL if the allocation fails" it only ever returns void* which is why u can cast it to a pointer to any type in the first place.
Why did I get a segmentation fault then? Not saying you're wrong, but gcc will give me a Segmentation Fault if I attempt to dereference a null pointer. As for it returning void, not sure if thats true, but it does indeed become of value NULL, because it a becomes a pointer pointing to nothing, and a pointer without a valid address is a value of NULL.
You deleted your comment, but you were right about one thing, malloc can return a void pointer type if your allocation fails for a reason other then insufficient memory, no need to get hostile, I'm not afraid of being wrong
Dude your code is super unsafe!!!
Kidding. Can you please start a patreon. I don't want these videos to stop.
Dude your commend is super unsafe!!!
Mac was 1984
Maybe you were thinking of the Altair?
Yea, I was thinking Altair, the first picture is the wrong computer
@@ProjectXiel thank you for acknowledging
Also animations that show the data going to and from the memory and not just the code would be helpful for beginners
I'm a very visual person and until I had all the stuff visualized and animated in my head did I begin to understand the very simple concepts of pointers that have been greatly exaggerated due to overly technical terminology and referring to the syntax of C, which is quite poor but when compared to assembly is like a panacea
How do I work with my DDR4 in C!?
I have some recommendations Xiel:
The Art of Software Engineering
The Art of Operating Systems
The Art of Compilers
The Art of Front-End Development
The Art of Databases
The Art of Data Structures
The Art of Algorithms
Ill see what I can do
@@ProjectXiel Just make sure to take your time! Take it easy champ!
C is very easy than C++.
C++ is very difficult.😢
you lost me at arrays, video suddenly went from explaining clearly to straight up CS-lecture.
Don't overcomplicate it, if you understand what an array is then it should be kinda simple. Basically you have bunch of memory addresses, each one able to hold 1 byte of data, so 1 index will be 4 memory adresses, incrementing the pointer will go forward 4 addresses or 1 depending on the data type, thats all indexing is. The array is a pointer to start of the memory block (the first index). Thats basically it, instead of declaring 1 variable you're declaring multiple variables at the same time basically. malloc, calloc, and realloc, are basically giving you the ability to allocate, deallocate and resize memory freely, the compiler handles the statically allocated memory (normal arrays), but you handle the dynamically allocated memory. The syntax for dynamic memory alloction does look kinda confusing, but I think I did an ok job at explaining. idk I tried
LOL i was watching the video and thought it was a 1 million+ view and was going to comments
I have to be a subscriber now ❤️🫡
nice video, do you have a discord group
No, but I might have one at some point, depending on what happens