Just enough C to have fun

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

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

  • @Kelsu_
    @Kelsu_ 24 дня назад +32

    One of the best C classes that i have seen in my whole life, way better than the college classes i attended. I apreciate

  • @ProVrakian
    @ProVrakian 18 дней назад +14

    Thank you for treating your audience like adults. This is the right amount of fast-paced and insightful.
    I appreciate a video that is meant to inspire people to dig deeper.

  • @ivankevamo
    @ivankevamo Месяц назад +36

    Great job. I have to thank the youtube algorithm for suggesting your channel. Thanks a lot. Greetings from South America.

    • @djianstankovich100
      @djianstankovich100 Месяц назад +1

      i agree with you and my greetings from Egypt 👏💪

  • @Artem1I9a
    @Artem1I9a 18 дней назад +3

    The best explanation of how memory works that I've ever seen. Very clear. Thanks for your effort.

  • @Humble_Electronic_Musician
    @Humble_Electronic_Musician Месяц назад +17

    The content and presentation is top notch.
    I also like your eloquent speech: I'm interested in low level programming, but even if i was not, I would probably listen to this vid.

  • @pavalep
    @pavalep 9 дней назад +1

    kay..thanks for this awesome series. Im a react native developer who is interested to learn thee nitty gritty of coding. but actually lacks the core concepts. will be following ODES series as i find the videos very enlightening👍

  • @chowder9576
    @chowder9576 24 дня назад +2

    I randomly saw this on my RUclips feed and so glad I watched. I don't even code in C but it was interesting learning something new! I hope to see more videos! :)

  • @kscd009
    @kscd009 Месяц назад +3

    Gold mine of content. This deserves much more audience

  • @obrikash9123
    @obrikash9123 Месяц назад +1

    I really enjoy your videos as i had some experience with c++ and i almost understand all of just C. I think this video format is great for people who are already informed about basics, pointers and memory concepts. Love from Moscow, Russia

  • @UliTroyo
    @UliTroyo Месяц назад +10

    C really is fun! And because it's been around for so long, used textbooks on Amazon are dirt cheap.

    • @stefanalecu9532
      @stefanalecu9532 19 дней назад

      I don't see you making the same argument for Fortran and Pascal ;)

  • @GreeneThumbs
    @GreeneThumbs Месяц назад +1

    I've recently started learning C, and this video is perfect. I really like the format and presentation. Thank you!

    • @50lek
      @50lek 27 дней назад

      I need to learn C++ for work, and its also really complicated in my opinion. What do you think?

  • @charlesmarseille123
    @charlesmarseille123 27 дней назад

    the explanation of the function pointer in the memory space is great. well done.

  • @dominichawkins7997
    @dominichawkins7997 2 дня назад

    Poor hand writing is a sign of intellect':] You rock!

  • @dixztube
    @dixztube 29 дней назад

    Just had to comment again and I’m a new subscriber. This was so good. You’re very intelligent and explain things well. Made all this seem very easy

  • @onurolce
    @onurolce 8 дней назад

    What a calm person you are !:) First time I've watched your video. So let me check your playlists :)

  • @Marco-pz5dx
    @Marco-pz5dx Месяц назад +32

    I liked the video, but honestly probably a bit too hard for beginners. Honorable mission though. In particular, the attempt to simplify some topics may actually end up misleading: on discussion about returning strings, I can see how you really try to explain variables' lifetimes but without mentioning them explicitly only focusing on the example. I would try to instead insist on the notion of lifetime and then go on explaining why callee variables on stack cannot outlive their lifetime and be accessible from parent (i.e. they "expire" upon return, and thus caller's attempt to access that now potentially overwritten stack memory is flawed). I would also showcase how a struct wrapping the fixed size array is possible due to return semantics.

    • @neoeno4242
      @neoeno4242  Месяц назад +22

      Such an interesting perspective - thanks for sharing, appreciate it and I'm sure others will too.

    • @jamesdoe2139
      @jamesdoe2139 Месяц назад +1

      @neoeno4242 do you have a Discord server/are you a Discord user?

    • @parallelno
      @parallelno 2 дня назад

      Thank you for the video. Please review the memory dump you're showing. Each line should display 16 bytes, but yours only shows 8. Additionally, please verify the byte order. On most modern architectures, it should be little-endian, meaning the smaller byte appears first.

  • @hasanhuseyinyurdagul5403
    @hasanhuseyinyurdagul5403 Месяц назад

    The presentation and whole video overall was very smooth, even though I already knew this stuff, I watched until the end. Subscribed, very good content.

  • @cincooitodois
    @cincooitodois Месяц назад +1

    youre awesome, kay! learning a lot from you. thanks!

  • @modolief
    @modolief 29 дней назад +1

    Good explanatory content for beginning C programmers.

  • @kriszenn1125
    @kriszenn1125 9 дней назад

    The for-loop is syntactic sugar for a while loop with the following setup:
    initialization;
    while (condition) {
    increment;
    }
    and its equivalent for-loop
    for (initialization; condition; increment) {
    }
    EDIT: i think it's easier to think of a for-loop as:
    for (before; during; after) {
    }
    but that can be confusing too. "During" is the condition that is technically checked *before* running the , but one can say that it's constantly being checked *during* the loop. "Before" is self-explanatory, but "after" seems confusing. "After" is code run after the has done its thing.

  • @adekorir
    @adekorir Месяц назад +1

    perfect for my reintroduction to the c programming language.

  • @devoiddude
    @devoiddude Месяц назад

    I have a background in java and actually started in C last week, was openai to help me show examples etc but this video was very helpful, thanks so much!

  • @deutschWallah
    @deutschWallah 16 дней назад

    Hey Kay, this is really good class. I hope you take more of such classes, maybe involving more of gdb and valgrind and other mess which we usually face 🙂 Really really good work.

  • @johnsteve1276
    @johnsteve1276 8 дней назад

    Great content. Appreciate your hard work. Btw, could you make a video about C++ ?!

  • @1732ashish
    @1732ashish 21 день назад

    thanks for this crisp, to the point video.

  • @AnimeKing-m2t
    @AnimeKing-m2t Месяц назад

    Such an amazing talk...pure code and explanations.

  • @caspersro
    @caspersro 2 дня назад

    i like your way of giving the information good work really i have a little knowledge of C Language so i may ask you to teach me and others like me C Language like this way
    Thank you in Advance 😍😍😍😍😍

  • @ItsRyanStudios
    @ItsRyanStudios Месяц назад

    I've been having a crisis of meaning lately; I love my work as a web dev, but every day I'm just writing bloat.
    I was looking for a good intro to C or embedded development; grateful the algorithm sent your channel to me 👍

  • @latch909
    @latch909 4 дня назад

    This rules, someone lovely making nice videos about C what could be better

  • @calderarox
    @calderarox 10 дней назад

    this is a great video! thanks for sharing

  • @Tenshi-sk8ty
    @Tenshi-sk8ty Месяц назад +38

    bro is majestic

    • @2wheels2
      @2wheels2 Месяц назад +1

      bro is trans

    • @thomasredden3159
      @thomasredden3159 25 дней назад +4

      she is slaying physically and intellectually 💅

    • @bmno.4565
      @bmno.4565 24 дня назад

      Agreed, what a fierce flow.

  • @veto_5762
    @veto_5762 27 дней назад

    I don't even know why I'm watching this since I've been using c++ for like 3 years now, still nice video

  • @codephilosopher
    @codephilosopher 18 дней назад

    Thank you, your videos are very enjoyable to watch.

  • @bradmccoy1747
    @bradmccoy1747 Месяц назад

    I enjoyed this video. I liked how you connected everything together. I am a less than beginner level in C. I have been in Assembly for quite a while now. I have have bounced into all of these concepts during my own writes and you lay it out so nicely and I like how it doesn't have to be fast and skippy. The whole concept of a function returning data has bothered me for some time now. The concept is an abstraction from what is really happening. A function call is really just a sugary goto but with a fancy way to return to the next line after the goto. And when the function does return; it just cannot carry data with it - LOL. But it could have altered the values in the registers. And our ancestors created a fancy trick by altering the RAX (EAX, AX, AL, AH) register; then copying that new value into a variable on the caller side. This gave the illusion in our beloved gen 3 languages that a function may return a value. But it really didn't, it just changed a register value. My point is that now everyone wants to return big stuff from functions and it has just gone too far. Ok - thats my rant for the day. And your video supports my thoughts with realistic examples. Love it!

    • @neoeno4242
      @neoeno4242  28 дней назад +1

      Thanks for the comment! Really enjoyed reading it. I'm looking forward to getting more into building up the 'function' abstraction through assembly in the next couple videos. Was just playing around with it today actually. Exciting!

  • @nazneenzafar743
    @nazneenzafar743 Месяц назад

    Thanks for the lesson. I hope you keep up with producing awesome content.

  • @t1nk3rtail0r
    @t1nk3rtail0r 22 часа назад

    Very, very good !

  • @offlinemark
    @offlinemark Месяц назад

    Great video, thanks! I'm using C to build a little hobby os for fun, and this is a nice refresher video :)

  • @mantra578
    @mantra578 21 день назад

    i really had fun watching this

  • @Gersberms
    @Gersberms 21 день назад

    I really love your style of presenting the source, the structure of your story, and just the easy going nature of it all. I will gripe about using two spaces for indentation, so -1 point for that, but +2 points for showing simple macros so that I now no longer feel that I need to avoid them. Thanks! Oh and, printf is super slow because I believe it's monstrously complex, so that might be worth mentioning (plus security risks I believe). And is make really worth using?

    • @neoeno4242
      @neoeno4242  20 дней назад +1

      Thanks! And all good points - I can definitely feel the complexity of printf coming through when I reach for it :) Re: make, with these videos questions like that are often a balancing act. Could use a plain shell script but then learners might not remember make at all and that can be confusing later, or could go for something more fully featured and then you're going to also have to include setup instructions and risk diverting attention. My angle is often trying to put people in a position where they've encountered the right set of things to then go build on the basics later - rather than taking a sophisticated approach early on and getting muddled. Could easily argue for other tradeoffs though! Anyway, thanks for the comment :)

    • @Gersberms
      @Gersberms 20 дней назад

      @@neoeno4242 You're right about make and your approach. This was more of a personal curiosity, and not a comment on your content. I got inspired by Handmade Hero that a batch file or shell script will suffice because usually it's just a few lines of mkdir, copy, gcc and run. So I have come to rely on a simple VS Code "skeleton project" as I clumsily called it that does these things: build, debug, and test. Whatever language I'll use is not even important because the concept works for whatever I'm making.
      You done any video on git yet? VS Code and git are a match made in software heaven.

  • @clintquasar
    @clintquasar Месяц назад +1

    Great teacher!

  • @MarianoBustos-i1f
    @MarianoBustos-i1f 28 дней назад

    This comment works roughly as you would expect it: you make an awesome video, I comment nice stuff.

  • @4ozmane
    @4ozmane Месяц назад

    The clip cuts are nice to keep things moving, keep making educational videos plz

  • @z0rba566
    @z0rba566 12 дней назад

    thank you yt! thank you Kay! can I request for a holy-C playlist !

    • @neoeno4242
      @neoeno4242  8 дней назад

      Just added playlists to my todo list!

  • @FocusAccount-iv5xe
    @FocusAccount-iv5xe Месяц назад

    This was wonderful. Thanks!

  • @ytbacc0001
    @ytbacc0001 Месяц назад +1

    Thank you for this video

  • @VforVanish
    @VforVanish 15 дней назад

    If the memory is allocated with malloc and returned, if we call printf it wont be corrupted no?
    That problem was because the array was on the stack?
    Very interesting videos an great teacher!

    • @neoeno4242
      @neoeno4242  8 дней назад +1

      Yes that's correct!
      Though if we use malloc in the function then we will have to decide when to free or 'give back' that memory (since in C nothing will free it up automatically and if the function is called repeatedly this will eventually use up a lot of memory).
      So string functions in C instead typically take a pointer to a buffer as an argument and then alter that buffer. That way the caller is responsible for allocating and freeing memory however they see fit.

  • @dixztube
    @dixztube Месяц назад

    Wonderful job!

  • @jimshtepa5423
    @jimshtepa5423 Месяц назад +2

    do you have a map of topics you plan to cover in the next10-15 videos?

    • @neoeno4242
      @neoeno4242  Месяц назад +7

      Working on it :) At the moment I'm working towards creating binary executables from scratch as a little milestone. That will involve spending a bit more time working with binary data, file formats, syscalls, and ASM. I think my planning will solidify in the next few months - will share more as that solidifies!

  • @mrinalyadav4261
    @mrinalyadav4261 Месяц назад

    this series is grt.

  • @SimGunther
    @SimGunther Месяц назад +2

    TL;DW
    Noob: Why does the program segfault? I'm too used to OOP!
    Expert: The stack does too good a job cleaning itself up, which is why you can't just return an array like that in your string concat function.
    Noob: Seriously, why doesn't it work like I expect it to?
    Expert: Because with great memory control comes great responsibility.
    Noob: So I can just make a big array at the beginning of the program and use that instead of worrying about free andMalloc?
    Expert: That's what I do in my prototypes anyway until I find it necessary to allocate such memory by hand.
    Noob: I'll just stick with JS and hope for the best.
    Expert: Wait a minute, you can still leak memory in J-
    Noob: _Sees browser crash due toOOM error_ Thanks anyway, I'll just stick with my abacus. At least that doesn't break on me when I least expect it to...

    • @neoeno4242
      @neoeno4242  Месяц назад

      This is my fave one: ruclips.net/video/GcDshWmhF4A/видео.html

  • @egu00
    @egu00 Месяц назад

    enjoy your video, thanks!

  • @salim444
    @salim444 Месяц назад

    the first this I do in an empty main is allocate 5k array just for the sake of it. Feels great to allocate arrays and then free it

  • @Isaac-zy5do
    @Isaac-zy5do 18 дней назад

    At 14:00 i think it should either be nums[0] = 0x10; nums[1]=0x20; etc or 0a 14 1e in memory

  • @estebanmorales9736
    @estebanmorales9736 12 дней назад

    incredible

  • @onurolce
    @onurolce 8 дней назад

    12:46 unsigned char MAX should be +255 , am I wrong ?

  • @WippSheridan
    @WippSheridan Месяц назад

    Nice video. And I like your shirt. It looks good on you.

  • @cevmantius
    @cevmantius 14 дней назад +1

    Lord Farquaad

  • @josephlagrange9531
    @josephlagrange9531 Месяц назад

    Hi, I subscribed yesterday.

  • @rescyy2235
    @rescyy2235 Месяц назад +2

    What text font are you using?

    • @neoeno4242
      @neoeno4242  Месяц назад +1

      Largely: Monaspace Xenon for the code font, and Mona Sans for the rest. Sometimes I mix up the monaspace font families though :)

  • @sanctuary_of_soul
    @sanctuary_of_soul Месяц назад

    at 8:32 i believe there is something off in how the sentence is composed logically.
    "...it just gets inlined straight into the file, and everything in the other C file gets chunked into the C file we are including from..."
    "...chunked into the file we are including from..." does it?
    Or am i missing something?

    • @BoardGameMaker4108
      @BoardGameMaker4108 29 дней назад

      You are right, that might be a small mistake. For anyone looking at this later, it just does a simple copy and paste (from the other file into your file).
      By convention, we also generally separate code into two files "header files" (.h) contain code that you want to be copied into other files (you can #include them). Implementation files (.c) contain code that you don't want to (or can't) copy around. One thing to note is that you cannot copy function implementations, so leave the implementation in a .c file, and the declaration in the .h file. This lets you use the function in other places without having multiple functions with the same name causing a linking error.

    • @neoeno4242
      @neoeno4242  28 дней назад

      Yes it's not super clear - thanks for flagging and also to @BoardGameMaker4108 for clarifying. Appreciate it.

  • @antonio_carvalho
    @antonio_carvalho 12 дней назад

    Spec requirement: high tech title card. ☑️

  • @JohnDoe-kh3hy
    @JohnDoe-kh3hy Месяц назад +1

    Excuse me, young fellow. May you please provide me with some advice on how to become a professional (or better yet, dangerous) C programmer. Thanks a bunch

    • @neoeno4242
      @neoeno4242  Месяц назад +1

      By way of advice on going pro with C I'm not sure I have anything really revelatory - it does appear like safer systems languages like Zig, Go, Rust are gaining popularity lately. If you're looking into C though, common pro books I see recommended are: C Programming, A Modern Approach by K N King and The C Programming Language by Kernighan, Richie. On top of that, write a lot of code and ideally run it yourself day to day :) Why use the built in `ls` when you can make your own and feel all the pain when it doesn't work? Wishing you good fortune.

  • @araz911
    @araz911 Месяц назад +3

    whaf js yonr genper?

  • @everythingcouldbesimplify818
    @everythingcouldbesimplify818 19 дней назад

    Tests in C I didn't know they existed

  • @ga1agen
    @ga1agen 23 дня назад

    19:13 - what the hell each 4 bits have its own address? x86 cpus can only address minimum a one byte(8 bit)... and other cpus, except microcontrollers( where part of memory can be 1-bit addressed for gpio)

    • @neoeno4242
      @neoeno4242  23 дня назад +1

      Ah yes, my mistake - thanks for flagging. I mistakenly gave each digit its own address, which isn't correct! Should be something more like this: link.excalidraw.com/readonly/KooN4ScH7IO4QuRsZtEG

  • @christopher8641
    @christopher8641 25 дней назад

    great! video

  • @seekyou
    @seekyou 23 дня назад

    watching this quite cool video feels a little bit like stealing for the goodness received for free!

  • @vasantheee
    @vasantheee Месяц назад

    Is it possible that the assert without printf could also fail at 25:10 because buffer variable is reallocated to something else? I am not sure why it is stated here that the program fails only after printf is added.

    • @anon_y_mousse
      @anon_y_mousse Месяц назад

      Because it's on the stack and the stack is changed after calling printf(). Literally any function which makes use of some stack space would have the same effect.

    • @vasantheee
      @vasantheee Месяц назад

      ​@@anon_y_mousse but even without modifying our program, it is possible that stack memory could be allocated or used by some other program and there is no gurantee this program would work everytime (without printf Or any other change) right?

    • @anon_y_mousse
      @anon_y_mousse Месяц назад

      @@vasantheee I certainly wouldn't depend on it being valid after the function call, but OS's typically will allocate a stack per thread or process, depending on configuration. However, depending on what the compiler does to your code, even if you don't make a function call, it's likely that data higher up on the stack could be instantly invalidated upon function return. For older chips and microcontrollers, if you have a stack at all, then all parameters would be passed on the stack, generally, and then upon return, anything allocated off the stack inside the function would be instantly invalidated. For newer chips, it's pretty much a given that parameters will be passed by register if you have few enough parameters, but the compiler might very well finagle your code such that it has to push and pop some data around the function call which would thus invalidate the array.
      In short, you don't have to worry about other programs running on the system invalidating your stack because your own program will likely do it without you directly seeing the effects.

    • @vasantheee
      @vasantheee Месяц назад

      @@anon_y_mousse thank you. So we cannot count on the program being successful like it happened at 25:10 all the time, right?

    • @anon_y_mousse
      @anon_y_mousse Месяц назад

      @@vasantheee I would say we shouldn't ever count on it. The thing to remember, if you want to work with an array, pass it into the function. If you want it to be resizable, then pass the address of the pointer. If you want to do dynamic arrays, then consider using a struct and passing the address of that struct, say typedef struct { size_t length; int data; } array_t; and just replace int with whatever type you wish to have an array of. You could even make the array type something like int_array_t or array_int_t or whatever name you feel like.

  • @manfredbogner9799
    @manfredbogner9799 Месяц назад

    Sehr gut

  • @richardappow6770
    @richardappow6770 Месяц назад

    what code editor are you using here?

  • @rvft
    @rvft 24 дня назад

    Bro choose the arch linux way

  • @RossDmoch
    @RossDmoch Месяц назад

    But what if want to live dangerously in C? 😂

    • @neoeno4242
      @neoeno4242  Месяц назад +1

      Then use after free all you like 😈

  • @juanmacias5922
    @juanmacias5922 Месяц назад +2

    gcc will erase the source file if you don't call it in this format "gcc file.c -o executable" lol

    • @w花b
      @w花b Месяц назад +2

      Very strange

    • @juanmacias5922
      @juanmacias5922 Месяц назад

      @@w花b I'd say it's just different implementations. :D

    • @anon_y_mousse
      @anon_y_mousse Месяц назад

      What version of gcc are you using that it does that? I'm currently using 10.3.1 and it definitely does not erase the source file. If this is said in the video somewhere, then what's the time index?

    • @juanmacias5922
      @juanmacias5922 Месяц назад

      ​@@anon_y_mousse waaaait, is this just a me thing? HAHA
      $ gcc --version
      gcc (GCC) 14.1.1 20240522
      Copyright (C) 2024 Free Software Foundation, Inc.
      This is free software; see the source for copying conditions. There is NO
      warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
      $ nvim test.c
      $ gcc test.c -o test;./test
      Hello, World!
      $ gcc test -o test.c;./test
      /usr/bin/ld: cannot use executable file 'test' as input to a link
      collect2: error: ld returned 1 exit status
      Hello, World!

    • @juanmacias5922
      @juanmacias5922 Месяц назад

      @@anon_y_mousse thinking the issue might be that the executable already exists, I ran it after rm it:
      $ gcc test -o test.c;./test
      /usr/bin/ld: cannot find test: No such file or directory
      collect2: error: ld returned 1 exit status
      bash: ./test: No such file or directory

  • @nixrohan
    @nixrohan Месяц назад

    You is a dream waifu for many including me :3

  • @omnilistic
    @omnilistic Месяц назад

    bruh you pretty as hell T_T