C is The MOST Beautiful Language!

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

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

  • @tuxorizon
    @tuxorizon 4 месяца назад +10

    I'm an absolute beginner in C programming, watching your video gave me the impetus I need to learn C language upto becoming a master. Thank you and have a felicitous intellectual journey ahead!

    • @matgla95
      @matgla95  4 месяца назад +2

      Thanks! let's do it! Keeping fingers crossed!

  • @natam1616
    @natam1616 4 месяца назад +13

    But it is defined as 'undefined behaviour' the part of the code >>k++*k/2

    • @matgla95
      @matgla95  4 месяца назад +3

      Sure! Good point and that one is even reported by GCC, when using the -Wall flag :) but the goal of that exercise is to abuse whatever you can in the provided compiler to achieve the smallest possible source code

  • @jagagemo8141
    @jagagemo8141 11 дней назад +2

    Doesn't matter if it works, make it readable or I'm not approving your PR.

    • @matgla95
      @matgla95  11 дней назад

      me too, it's totally unuseful code :) and it sometimes works because it uses old GCC compiler implementation hacks

  • @a.v7998
    @a.v7998 4 месяца назад +5

    My First Programming language was python, then I moved to C. When I was Learning python i struggled with logic building. But After learning C im getting better with Logic, and Also Better at JavaScript.

    • @matgla95
      @matgla95  4 месяца назад +1

      Yup, different languages due to different paradigms enforce to improve the skill set and it seems you have a win-win outcome :)

  • @telotawa
    @telotawa 4 месяца назад +15

    imagine not knowing how long your integer primitives are because it depends on the platform
    nice elegance bud

    • @matgla95
      @matgla95  4 месяца назад +2

      thanks, It's even worse when types promotion come to case when you have different type sizes on different platforms.

    • @redcrafterlppa303
      @redcrafterlppa303 4 месяца назад +3

      stdint.h...
      Anyone not using them is just stupid or has an old codebase.

    • @tiranito2834
      @tiranito2834 4 месяца назад +2

      Ah yes, because we sure do love writing non portable code! are we forgetting about the fact that C is a systems language? if you need code specific to a certain platform, then use stdint.h types, if you need portable code that works between platforms where you don't know what the width will be, then use standard integer types.
      I thought this was figured out like 50 years ago, we can't have devolved that much, right...?

    • @redcrafterlppa303
      @redcrafterlppa303 4 месяца назад

      @@tiranito2834 why should normal ints be more portable?
      There is no real point in using normal ints over standard int.
      Platform dependent types are only necessary for system level interfaces and working with pointers. And in most cases the explicitly platform dependent size_t is all you need.
      Having the possibility that your int might be "arbitrarily" long depending on the platform might even cause bugs in form of unexpected integer overflow or compile errors in case of to large literals.
      Tldr always use stdint.h if possible. It makes the code more stable and compatible and portable.

  • @ethical-not-evil
    @ethical-not-evil 4 месяца назад +2

    it will works cuz of gcc it set variables and funcs to type int as default

    • @matgla95
      @matgla95  3 месяца назад +1

      Yes, but it uses more than that :)

  • @hugoandres5937
    @hugoandres5937 4 месяца назад +2

    Answering your question about what languages I want to learn are: I've been trying to learn Rust for months, I took courses and read books but I haven't made any progress, I feel stuck, my goal with Rust is the backend, even in the same book it tells you that before that you must know C++. My biggest dream is to master Rust and then C++. that's why I started following your channel, thanks

    • @matgla95
      @matgla95  4 месяца назад +2

      Yes, Rust/C++ require a lot of time invest. They are really hard to master, but still you can write good code without mastering each piece of a particular language.

    • @hugoandres5937
      @hugoandres5937 4 месяца назад +1

      very thanks, greatings
      saludos desde Bolivia, querido amigo.

    • @youarethecssformyhtml
      @youarethecssformyhtml 4 месяца назад

      There are better languages for backend

    • @hugoandres5937
      @hugoandres5937 4 месяца назад

      @@youarethecssformyhtml For the niche I am aspiring to, they are the fastest and what I need to learn. Thanks for your comment, greetings

  • @cyrusol
    @cyrusol 4 месяца назад +2

    Erlang, any ML, any Lisp and Haskell are beautiful.
    If someone finds C beautiful they also find spoiled foods yummy.

    • @matgla95
      @matgla95  4 месяца назад

      I think beauty is subjective and depends on context. Here I used it a little bit ironically, since you can still do things that should not be allowed, at least by default. Hopefully compilers are evolving and, i.e. GCC 14 rejects such code by default which is good in my opinion!

  • @Shnaypur
    @Shnaypur 4 месяца назад +2

    Swietny material. Wiecej tego sortu filmikow :) Jakbys jeszcze tylko wrzucal regularnie materialy to mozna by pomyslec o jakies formie wspierania kanalu

    • @matgla95
      @matgla95  4 месяца назад +1

      Dziękuję! Regularność niestety aktualnie nie wchodzi w grę, choć marzy mi się przyspieszenie montażu (pewnie kwestia wprawy). Kanał rozwijam w swoim wolnym czasie, a do tego dopiero uczę się nagrywania i montażu :) Póki co wystarczy lajk lub miłe słowo :)

  • @hugoandres5937
    @hugoandres5937 4 месяца назад +2

    Any advice for learning to program, without staying in the infinite loop of the courses, any tips that were useful to you, thank you

    • @matgla95
      @matgla95  4 месяца назад +2

      I always recommend doing actual programs instead of courses. To be honest I almost always boycott most of course, it's too boring for me instead I am using them as a "what to learn next" list. Then think about what program you could wanna write and try to do it. It won't be perfect for the first time, but you can gain real experience and continuously improve it. It could be big or many small ones, but always think how you can improve them after all. When I was taking part in interviews in my previous company always the best candidates were with people that came with projects on GitHub that they prepared by themselves and it was easier for them to adapt to project.

    • @hugoandres5937
      @hugoandres5937 4 месяца назад +1

      @@matgla95 very thanks 🙏🏻

    • @hugoandres5937
      @hugoandres5937 4 месяца назад

      @@matgla95
      Let's say I want to learn how like you, where would I start, if there is a lot of information, like the basics without having to go through the courses, the githubs are huge and there are topics in a single repository of different things, the documentation is technical and difficult, as you did at the beginning to later be able to extricate yourself from c, this answer would help me a lot more. greetings

    • @matgla95
      @matgla95  4 месяца назад +2

      I don't mean to completely drop courses, they are necessary to learn basics. I also started with a course something like " from zero to games coder". And with each exercise I did a similar one on my own. Like it was a random number generation section with exercise with solution, so I did it, but then wrote my own program that also uses random number generation. With some basics I started writing game, since it was fun for me, step by step. With no knowledge it required a lot of internet research, like the first goal: select library, then render black window in OS... Trying to move from courses to reading reference manuals for language and documentation for libraries. Today all those GPT/Copilot could help to speed up information searching on given topic.
      Starting you may want to write as much as possible on your own, it's reinventing a wheel, but needed if you want to get deep knowledge.
      But most important is to find a way of learning that makes you fun. If it's not fun most probably you won't be able to spend enough time to grow fast, so the whole road will be longer. Keeping fingers crossed :) Which language you are trying to learn?

    • @hugoandres5937
      @hugoandres5937 4 месяца назад

      @@matgla95 I've been trying to learn Rust for months, I took courses and read books but I haven't made any progress, I feel stuck, my goal with Rust is the backend, even in the same book it tells you that before that you must know C++. My biggest dream is to master Rust and then C++. that's why I started following your channe

  • @thefanboy3285
    @thefanboy3285 4 месяца назад +1

    What does the tilde ~ symbole mean in C ? Just before the scanf

    • @matgla95
      @matgla95  4 месяца назад

      It just performs bitwise negation on value returned from scanf function to break loop when got EOF ( which normally is -1 ).

  • @stefanalecu9532
    @stefanalecu9532 2 месяца назад

    You know, the more I watch this video, the more I'm grateful I'm a Pascal/Delphi and Ada dev, this is wild, I feel pity for C devs 💀

    • @matgla95
      @matgla95  2 месяца назад

      To be honest, me too. C can't be substituted in some environments. But whenever it could be I think it should be. I mostly use C++, but I am looking for tools that can improve or even replace it into safer language transpilers ( like cppfront ), where other compilers like (i.e rust are not fitting). But I really hope that the standardization committee will resolve most of the problems some day.

  • @i_isak1451
    @i_isak1451 4 месяца назад +1

    I guessed correctly but I liked anyways! Good video

  • @technikusMagna
    @technikusMagna 2 месяца назад

    Nice code bro

  • @qy9MC
    @qy9MC 4 месяца назад

    main(k){while(scanf("%d"))printf("%d
    ",k++*k/2);}
    is it a valid solution? It is 3 characters shorter.
    Also the original version with "%d " gave me segfault so I went with "%d
    ".
    I would like to try more but I really don't understand the coding challenge here. Why do we even scan for numbers? The rules are unclear to me, perhaps it's due to traduction from polish.

    • @matgla95
      @matgla95  4 месяца назад +1

      So, let me clarify a little bit.
      The code is on SPOJ and is executed for 10 test cases.
      Test data is provided on STDIN in the form:
      1

  • @jindrichcapek9836
    @jindrichcapek9836 4 месяца назад

    Why is there a space between %d and
    ?

    • @matgla95
      @matgla95  4 месяца назад

      Originally that code doesn't contain
      . It was added just to better presentation of execution. The testing from SPOJ is executed for many inputs from stdio and space is necessary to separate outputs for test cases.

  • @CodingWithDox
    @CodingWithDox 4 месяца назад +1

    can u give us a link to the challenge

    • @matgla95
      @matgla95  4 месяца назад

      Sure, pl.spoj.com/problems/SUMAN/
      And more exercises and challenges like this are here: www.spoj.com/

    • @CodingWithDox
      @CodingWithDox 4 месяца назад +1

      @@matgla95 I have a 52 letter solution but how do I make it use the correct compiler :c

    • @matgla95
      @matgla95  4 месяца назад

      And that was one of the reasons that I decided to publish that video :) it's an old challenge and the current solution is easy on the internet to find, so I hoped someone will try to reduce it more!
      Unfortunately since the whole website is old and I am not even sure it is maintained, the latest compilers are not available.

    • @CodingWithDox
      @CodingWithDox 4 месяца назад +1

      I lied, I misscounted, sorry for my ignorance :D

    • @matgla95
      @matgla95  4 месяца назад

      @@CodingWithDox I am glad you tried. Someday someone for sure will find a better solution :)

  • @HoangNguyen-nz4xe
    @HoangNguyen-nz4xe 4 месяца назад +1

    That is so cool 😂

    • @matgla95
      @matgla95  4 месяца назад +1

      Imagine my face when I found that type is not needed in the main function argument :)

  • @callisoncaffrey
    @callisoncaffrey 4 месяца назад

    I see Windows, I leave.
    Edited to get rid of the heart sticker.

    • @matgla95
      @matgla95  4 месяца назад

      Yes you're right, I have a problem with recording on Linux ( my camera interface produces crazy delays, most probably Nvidia again broke their driver xd ) which I haven't solved yet, so I temporarily switched to windows.

    • @callisoncaffrey
      @callisoncaffrey 4 месяца назад

      @@matgla95 That's no excuse to have it running in the background. Honestly, I'd be embarrassed. You do you though. I'm sure your excuses will safe you from the social credit system you help implement by running spyware. Oh, and don't get me started on the smart phone which I'm pretty sure you have too.

    • @matgla95
      @matgla95  4 месяца назад

      No no, I am only using pigeon post :)

    • @callisoncaffrey
      @callisoncaffrey 4 месяца назад

      @@matgla95 You sound like a smoker telling me that smoked meat takes longer to go bad. I guess the copium is always real. Anyway, you keep making excuses for being the corporations' female canine.
      Another thing though. Are you actually in Poland? We are always looking for Team Fortress people in Europe. I wrote a fork of the original for the Darkplaces engine with more emphasis on tactics and stealth.

    • @youarethecssformyhtml
      @youarethecssformyhtml 4 месяца назад

      Jerk

  • @thribsilva
    @thribsilva 3 месяца назад

    My solution to this in a theoretical language that sees and interprets whatever prompt you give it:
    an empty file. That language needs no code

    • @matgla95
      @matgla95  3 месяца назад +2

      No Code, No Problems! :)