Memory manipulation functions in C

Поделиться
HTML-код
  • Опубликовано: 3 дек 2024

Комментарии • 60

  • @fun-damentals6354
    @fun-damentals6354 Год назад +4

    possibly the best channel on yt for c. extremely simple and clear explanation, nice accent and good approach to teaching

  • @starfart69
    @starfart69 3 года назад +11

    This is a hidden gem I hope everyone sees. Reading the documentation can be frustrating for beginners.

  • @federicobau8651
    @federicobau8651 4 года назад +8

    Just start to learn C and I found your channel, i just subcribed and I don't regret it.

  • @profittaker6662
    @profittaker6662 5 лет назад +4

    Excellent series of over a hundred short videos (116) about basic computer functions and basic programming. These are the things every programmer should know master master first.

  • @pushkarnath1904
    @pushkarnath1904 3 года назад +1

    In youtube lots of channels are there but No one has ever say even one word about this topic
    Thanks dude I was searching for this 🤟🤟

  • @codinggirl_
    @codinggirl_ 4 года назад +7

    Thank you so much for such a clear explanation!!! Now I finally got the usage of these functions!

  • @MrAnandml
    @MrAnandml 3 года назад

    This is some great channel for C language

  • @habibhasanshakil9086
    @habibhasanshakil9086 2 года назад +1

    I have finished almost the full playlist "Unix process in c". I think some of the videos on this playlist are not in order. Anyway, your videos are helping me a lot.

    • @CodeVault
      @CodeVault  2 года назад

      Oh! Please do tell me which ones are not in order. I know RUclips sometimes messes up the order in there

  • @zltn_brkl
    @zltn_brkl 4 года назад +2

    Man you deserve even more subscribers and views, the effort you put into your videos is huge, thanks a lot. Also would have a question to you, I have some experience in C, and I really want to go through your tutorials, but I could not figure out what the real order of the videos are, could you help me out? Thank you best regards.

    • @CodeVault
      @CodeVault  4 года назад +4

      Thank you! Most videos don't have an orde aside from the linked list, processes and threads courses (which have their own playlist). They are meant as completely standalone videos so people can quickly understand a topic they are stuck on without having to go through hours of courses. But you're right, if you want to learn C from these videos it can be quite confusing... I will look into putting all videos in playlists basic on their topic, is that alright?

    • @zltn_brkl
      @zltn_brkl 4 года назад

      @@CodeVault I appreciate your help. Thank you very much.

  • @mukteshgautam4050
    @mukteshgautam4050 5 лет назад +4

    informative video, thanks sir! one question you said 1 is four bytes in int which is 0001its four bit right so that means every number has its own four bit i did not quite understand! it is stored in hexadecimal format in the program?

    • @CodeVault
      @CodeVault  5 лет назад +5

      "so that means every number has its own four bit"
      Now here's where your misunderstanding begins.
      A number, whether it be in the real world, in programming or in a video game doesn't HAVE bytes.
      BUT, a variable, the place where we can store numbers in a computer, does have BYTES.
      An INT usually has 4 bytes and a SHORT INT has 2 bytes.
      ---------------
      When I said that the 1 inside an INT is 0 0 0 1, each digit represented a BYTE.
      In hexadecimal it would be: 00 00 00 01
      In binary (the way it is stored in memory) would actually be: 00000000 00000000 00000000 00000001
      A 1 inside a SHORT INT i wrote it as 0 1, again, one digit per BYTE.
      In hexadecimal it would be: 00 01
      And in binary: 00000000 00000001
      Notice the difference?
      "it is stored in hexadecimal format in the program?"
      No, it always goes down to bits.
      So that was just a simplified notation on my part.

    • @mukteshgautam4050
      @mukteshgautam4050 5 лет назад +1

      @@CodeVault Thank you so much for explaining it so precisely!
      You have cleared all my doubts!
      : )

    • @sarvottampriyadarshee5425
      @sarvottampriyadarshee5425 4 года назад +1

      @@CodeVault also had the same doubt, very much cleared by you!

    • @sepgh2216
      @sepgh2216 11 месяцев назад

      ​@@CodeVault This is a part I struggled with as well. What I still can't understand is if it always goes down to bits, why didn't metset(arr1, 1,...) produce all bits as 1?
      Rewatched the video, if I am not wrong, thats due to memset accepting bytes in second parameter and not bits, or better say whatever goes in second parameter is treated as a byte and not bit.

  • @ahmniab
    @ahmniab Год назад

    you are the best man !

  • @carlosfernandez6470
    @carlosfernandez6470 2 года назад

    Sorry i keep watching and you explained 👍💪

  • @sarvottampriyadarshee5425
    @sarvottampriyadarshee5425 4 года назад +1

    man you explained it so damn sharp!
    Thank you so much!

  • @koraybulut3175
    @koraybulut3175 4 года назад +1

    Thank you so much!
    Excellent series of videos with clear explanations!
    But, the playlist is not organised.
    Please, short them.
    It would be much more clear.
    Thanks a lot man!

    • @CodeVault
      @CodeVault  4 года назад +2

      Yeah, sorry about that, that playlist is just a collection of ALL the C videos on the channel (in chronological order). I will create some playlist based on their topic, but the order is still not going to matter as most of them are meant to be standalone.

  • @04.nehalsingh12
    @04.nehalsingh12 2 года назад

    awesome tutorial sir

  • @carlosfernandez6470
    @carlosfernandez6470 2 года назад

    Why memset only works with 0(zero)?

  • @ailijic
    @ailijic 3 года назад +1

    Be careful when comparing structs. Do the compare element by element in case the padding is different.

    • @CodeVault
      @CodeVault  3 года назад +2

      Thanks but padding and alignment won't be different on the same system

  • @ezraakran7158
    @ezraakran7158 3 года назад

    Great explanation mate

  • @muhammadsafiullah8428
    @muhammadsafiullah8428 5 лет назад +2

    Appreciate you, man.

  • @ForeverNils
    @ForeverNils 2 года назад

    Thank you for your work

  • @MetroidVibes
    @MetroidVibes 3 года назад +1

    Hello ! Thank you for this great video. Would it be possible to have more explanation about the memset function ?
    I understood that we get "16843009" for each number when we print the result of memset as an int (with %d) because the hexadecimal result is "01010101". But as you said "memset will set every single byte to 1", I would expect the result of memset to be something like "00000001". There is probably something I don't understand about memory. I am reading about it, but I am still confused.

    • @CodeVault
      @CodeVault  3 года назад +4

      Well, an int has 4 bytes. Since memset sets every byte to 1 (in the example in the video) we get:
      01010101
      Note that this notation is in hexadecimal and each 2 characters represent a single byte. If we were to write it in binary you would get this:
      00000001000000010000000100000001

    • @MetroidVibes
      @MetroidVibes 3 года назад

      @@CodeVault it makes more sense now 😅 since I am new to this it’s still tricky sometimes !
      I’ll read about the use of %x, but can you tell me if it is possible to use printf to print actual binary format ?
      Thank you a lot ! :)

    • @CodeVault
      @CodeVault  3 года назад +1

      There's a video on it: code-vault.net/lesson/0iqp12va9m:1603820088926

    • @MetroidVibes
      @MetroidVibes 3 года назад

      @@CodeVault oh cool ! Thank you ! I finally made my own function to do that. But I’ll have a look at your video 👍🏼

  • @amanpatel6203
    @amanpatel6203 3 года назад

    wow woderfull explanation

  • @kamilziemian995
    @kamilziemian995 2 года назад

    I just discover your channel and want to watch all your videos on C. My skills in C declined in last years. Is there any order in which you should watch "The C programming language made simple"? I have on first position "Memory manipulation functions in C", definitely not "Hello World!" program. The latter being the most important program in the world!

    • @CodeVault
      @CodeVault  2 года назад

      The videos in that playlist were never made to be watched in any specific order. I did create some more specific playlists in which I added all the relevant videos and I put them in order from least complex to most complex (although, again, they are not perfect)
      Here you can check them out: ruclips.net/user/CodeVaultplaylists
      The Linked Lists, Unix Processes and Unix Threads playlists are actually made to be watched in order

  • @turuus5215
    @turuus5215 2 года назад

    Originally in the 1st int, we have a decimal expression of 0003, don't we?
    I'm a little confused by how it was turned into the hexadecimal expression of 01010101.
    Conversion looks like these: 0 01, 001, 001, 301. Why?

    • @CodeVault
      @CodeVault  2 года назад

      That's because of how memset works. So, let's take a look at arr1[0].
      First we have the element 3, which is in hexadecimal: 00 00 00 03 (each pair for 2 hex digits represent a single byte)
      Now, after we call memset(arr1[0], 1, 2 * sizeof(int));
      memset will change each BYTE to have the value 1, so since arr1[0] is an int that has 4 bytes we will get this value in arr1[0]:
      01 01 01 01 (in hexadecimal)
      In binary this would look like so:
      00000001 00000001 00000001 00000001
      Hope that's more clear now

  • @kotesh3777
    @kotesh3777 Год назад

    Hi is there any planning C++ concepts

    • @CodeVault
      @CodeVault  Год назад

      Yes, OOP and memory management in C++ are some of the topics I will look into

  • @justmell0o
    @justmell0o Год назад

    ti indus?

  • @adeled8833
    @adeled8833 4 года назад

    What if in memchr ima try to find the byte with a value of > 256

    • @CodeVault
      @CodeVault  4 года назад

      Since a byte can only go up to the value 255, you can't. You'll need to probably just make a for loop and check that manually.

    • @adeled8833
      @adeled8833 4 года назад

      CodeVault okay thank you :)))

  • @ragnarlothbrok367
    @ragnarlothbrok367 2 года назад

    bro u golden

  • @lg1360to
    @lg1360to 2 года назад

    can you suggest me c documentation?... I'm not able to find it.

    • @CodeVault
      @CodeVault  2 года назад

      The most reliable documentation that I use seems to be this site: www.cplusplus.com/reference/cstring/memset/

  • @laenprogrammation
    @laenprogrammation 2 года назад +2

    Small mistake : as c is little endian, the int 1 is actually : 1 0 0 0

    • @CodeVault
      @CodeVault  2 года назад +1

      That's correct. Good observation, it was a mistake on my part

  • @codewithovi997
    @codewithovi997 4 года назад

    Your videos are great but the playlist is not organised ... like i don’t understand which one is the first one in your playlist.

    • @CodeVault
      @CodeVault  4 года назад +1

      You mean the C playlist? That one is just all the videos related to C on the order they were uploaded... They weren't made in a specific order and aren't supposed to have a continuity.

    • @kkrolley
      @kkrolley 4 года назад

      @@CodeVault Please if you do find some time, do a C course you are very clear in your explanations!

  • @bakerstreet7833
    @bakerstreet7833 4 года назад

    good about memset!

  • @bcsamrudh
    @bcsamrudh 8 месяцев назад

    6:31 6:32 6:33

  • @ailijic
    @ailijic 3 года назад +1

    The method for comparing array of int and array of short only works on little endian systems, be careful.

  • @arvindersingh9863
    @arvindersingh9863 5 лет назад

    👍👍👍