The Art Of Pointers

Поділитися
Вставка
  • Опубліковано 15 жов 2024

КОМЕНТАРІ • 28

  • @juliansteden2980
    @juliansteden2980 Рік тому +1

    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" ;)

    • @ProjectXiel
      @ProjectXiel  Рік тому

      int array1[6] = {1,2,3,4,5,6};
      int n = sizeof(array1)/sizeof(array1[0]);
      cout

    • @ProjectXiel
      @ProjectXiel  Рік тому

      I genuinely just didn't realize the mistake bc I got the correct output

    • @ProjectXiel
      @ProjectXiel  Рік тому +1

      okay maybe not huge, but still embarrassing nonetheless, thank you for pointing it out though.

  • @Quantumbyte01
    @Quantumbyte01 Рік тому +3

    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

  • @salpelter
    @salpelter Рік тому

    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.

    • @ProjectXiel
      @ProjectXiel  Рік тому +1

      Thanks for the feedback I'll keep it in mind

  • @WarrenMarshallBiz
    @WarrenMarshallBiz Рік тому

    I love C. I adore C. It's the best thing, it's just SO fun and expressive...

  • @Lionasty1
    @Lionasty1 Рік тому +2

    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!

  • @anon-fz2bo
    @anon-fz2bo Рік тому

    @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.

    • @ProjectXiel
      @ProjectXiel  Рік тому

      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.

    • @ProjectXiel
      @ProjectXiel  Рік тому

      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

  • @shaartmcl
    @shaartmcl Рік тому +7

    Dude your code is super unsafe!!!
    Kidding. Can you please start a patreon. I don't want these videos to stop.

  • @ChrisAthanas
    @ChrisAthanas Рік тому +2

    Mac was 1984
    Maybe you were thinking of the Altair?

    • @ProjectXiel
      @ProjectXiel  Рік тому +1

      Yea, I was thinking Altair, the first picture is the wrong computer

    • @ChrisAthanas
      @ChrisAthanas Рік тому +1

      @@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

  • @LambdaJack
    @LambdaJack Рік тому

    How do I work with my DDR4 in C!?

  • @HollowNinja10
    @HollowNinja10 Рік тому +4

    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

    • @ProjectXiel
      @ProjectXiel  Рік тому +3

      Ill see what I can do

    • @HollowNinja10
      @HollowNinja10 Рік тому +2

      @@ProjectXiel Just make sure to take your time! Take it easy champ!

  • @beeboylinux7524
    @beeboylinux7524 Рік тому

    C is very easy than C++.
    C++ is very difficult.😢

  • @grod3an
    @grod3an Рік тому

    you lost me at arrays, video suddenly went from explaining clearly to straight up CS-lecture.

    • @ProjectXiel
      @ProjectXiel  Рік тому

      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

  • @mohamedabdelrehem7698
    @mohamedabdelrehem7698 Рік тому +2

    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 ❤️🫡

  • @johnbalogune
    @johnbalogune Рік тому +2

    nice video, do you have a discord group

    • @ProjectXiel
      @ProjectXiel  Рік тому

      No, but I might have one at some point, depending on what happens