C in 100 Seconds

Поделиться
HTML-код
  • Опубликовано: 2 июн 2024
  • The C Programming Language is quite possibly the most influential language of all time. It powers OS kernels like Linux, Windows, and Mac and many other low-level systems. Its syntax has inspired many other languages, including Cpp, Csharp, Java, JavaScript, Go, Perl, and more.
    #programming #compsci #100SecondsOfCode
    🔗 Resources
    C Manuel www.gnu.org/software/gnu-c-ma...
    GCC compiler gcc.gnu.org/
    C History en.wikipedia.org/wiki/C_(prog...)
    🔥 Get More Content - Upgrade to PRO
    Upgrade to Fireship PRO at fireship.io/pro
    Use code lORhwXd2 for 25% off your first payment.
    🎨 My Editor Settings
    - Atom One Dark
    - vscode-icons
    - Fira Code Font
    🔖 Topics Covered
    - C programming basics
    - C pointers
    - Memory safety and segmentation faults
    - C syntax
    - What is C used for?
    - History of C
  • НаукаНаука

Комментарии • 2,7 тыс.

  • @Beebo
    @Beebo 2 года назад +16276

    My professor had a saying: "You will die but C will live."

    • @awuuwa
      @awuuwa 2 года назад +327

      that's a good saying

    • @xCwieCHRISx
      @xCwieCHRISx 2 года назад +395

      Yea C wont die out because of embedded systems.

    • @RainMan52
      @RainMan52 2 года назад +536

      so long as there is electricity, C will be forever

    • @awuuwa
      @awuuwa 2 года назад +361

      ​@@Afterburn7 c is used in kernels and stuff.

    • @yoshiguy35
      @yoshiguy35 2 года назад +116

      @@Afterburn7 C++ is C with AIDS

  • @codegambit2507
    @codegambit2507 2 года назад +8846

    "Use prinffffff" 🤣🤣🤣🤣
    And those "C" puns at the end 👏🏾

  • @xpkareem
    @xpkareem Год назад +1656

    Becoming a programmer these days is like coming in to a movie theater halfway through the movie. Computer Science history weighs heavy over everything. After decades of messing around with computers and programming I understand the approach of learning things in the order they were invented- everything builds on what came before. Everyone should learn C first if they want everything that follows to be many time easier- because you will have context and won't need to constantly ask: "Why TF did they do it that way?" you'll already know.

    • @anthonyobryan3485
      @anthonyobryan3485 Год назад +154

      I went from BASIC to assembly to C back in the late 80's and early 90's. By the time I got to C, I already knew what "i++" and "++i" meant, how they were different, and why that difference was significant. I had already programmed position independent and re-entrant systems, and understood the benefits and costs involved. I understood why Motorola CPU's were/are far better at it than Intel.
      I agree with you that learning programming history is a huge, highly underrated benefit.

    • @yvvxn
      @yvvxn Год назад +54

      I studied the history of computing for 2 weeks straight before actually learning how to program.

    • @mansbjork5721
      @mansbjork5721 Год назад +43

      It would be insane to teach 15 year olds C, which is when we start learning some programming where I'm from. We start with Python. As someone whose first language was Python, I haven't struggled that much with C honestly.

    • @foodiusmaximus
      @foodiusmaximus Год назад +17

      Seems similar to the way one learns studio or fine art at the professional level. Nothing exists in a vacuum and the best artists reference what came before. Ongoing dialogue

    • @dipper5151
      @dipper5151 Год назад +8

      EXACTLY! I keep asking myself the same question: "WHY DID THEY DO IT THIS WAY". I can't focus due to this. Can somebody tell me how I can overcome this?

  • @chbrules
    @chbrules 2 года назад +819

    C is beautiful in its simple complexity. I started in C++ 18 years ago, but I've come to find warmth and love in the C language experience.

    • @harleyspeedthrust4013
      @harleyspeedthrust4013 Год назад +16

      I love C. Definitely one of my favorite languages, up there with ocaml and rust

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

      @Joltacks You just have to be touched by Dennis Ritchie to know. And he knows how to touch a man very well ;)

    • @thehammurabichode7994
      @thehammurabichode7994 Год назад +40

      Your toxic relationship with C++ has been discarded, and your heart has been soothed by the warmth of -"holy"- C 🖤

    • @usernotfound342
      @usernotfound342 Год назад +9

      @Joltacks It's simple: I started coding in C. I can now easily comprehend any other programming language.

    • @JerehmiaBoaz
      @JerehmiaBoaz Год назад +9

      18 years ago? Modern C++ is nothing like the C++ you experienced. C++ is a living language that is in constant development and from 2011 on gets a feature update every 3 years. The latest standard C++20 (introduced in 2020) is so different from the C++03 or even C++98 you experienced that it should be barely recognizable to you. C++17 is what got me back into C++ and C++20 is so much better.

  • @leoaso6984
    @leoaso6984 2 года назад +12527

    C is such a simple language that you could learn the syntax in a day, learn the important parts of the standard library in less than a week, and learn how to use pointers.... eventually.

    • @saeedbaig4249
      @saeedbaig4249 2 года назад +2002

      You can learn pointers... you never master pointers

    • @vaisakhkm783
      @vaisakhkm783 2 года назад +639

      @@saeedbaig4249I loved c and hated all other languages when i studying
      After my school, i had learned so many other langs, and I never even used c in my job or higher studies, but nothing same as c

    • @betterthanb4r
      @betterthanb4r 2 года назад +65

      @@vaisakhkm783 depends where u work

    • @vaisakhkm783
      @vaisakhkm783 2 года назад +89

      @@betterthanb4r yes, i ment that, eventhough i never used it.... i still love it....

    • @SteelHorseRider74
      @SteelHorseRider74 2 года назад +431

      ...once you see the pointer, which points to the pointer of the pointers' pointer

  • @jencruz21
    @jencruz21 2 года назад +6447

    Everybody: use print-F to print the value
    Jeff: *Use printfffff*

    • @evertonalmeida1165
      @evertonalmeida1165 2 года назад +329

      It's not Jeff it's Jefffffff

    • @quazar-omega
      @quazar-omega 2 года назад +114

      @@evertonalmeida1165 Je-F

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

      😂😂😂 lol

    • @_prothegee
      @_prothegee 2 года назад +9

      Ffffffff

    • @tarangpatil6952
      @tarangpatil6952 2 года назад +8

      @@_prothegee Ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

  • @Koubles
    @Koubles Год назад +573

    Being a CS student, transitioning from classes where C is the only language to now building modern apps with Kotlin/Swift and other various API's and languages. I now really appreciate the simplicity of C.

    • @liveinthecity11211
      @liveinthecity11211 10 месяцев назад +33

      Agree 100%. But I'm also grateful we have languages like Java that have garbage collection. Haha.

    • @onlinealias622
      @onlinealias622 7 месяцев назад +20

      I work as a software engineer writing C code on embedded linux, and while the C language may be simple, the bugs can be some of the worst ever. I'm finding I much prefer higher level languages. Also, the lack of a string type or decent string library (string.h is trash IMO) really hurts its usability. Also, legacy C code written by EEs who didnt know good programming practices is some of the nastiest stuff ever created lol

    • @justaway_of_the_samurai
      @justaway_of_the_samurai 6 месяцев назад +12

      If you ever programmed anything more advanced than an introduction to programming "Hello World" program in C, you would appreciate the simplicity of higher level languages.

    • @unheilbar
      @unheilbar 5 месяцев назад +14

      How long did it take you to turn from being heterosexual to kotlin developer?

    • @Koubles
      @Koubles 5 месяцев назад +3

      @@unheilbar AHAHAHAHA! Oh that's good. About one college course that praised AGILE and OOP like they were made by the second-coming of Jesus himself dude.

  • @manuchatterjee8809
    @manuchatterjee8809 2 года назад +482

    C is challenging to master because to truly use it well, one must understand fundamentally understand how computers work. This means having some ideas about registers and ASM syntax, while not required, greatly enhances interpreting why certain design choices were made in C.
    C allows interfacing to hardware in straight-forward ways (custom registers, memory mapped peripherals) which don't really make sense in higher level languages. So C excels at low and mid level tasks where performance and resource allocation are the most important criteria. But it is difficult to be time efficient if you have to mix complex dynamic data, such JSON or web content.

    • @alexeynezhdanov2362
      @alexeynezhdanov2362 2 года назад +9

      Well, it's true about almost(?) every language. If you want to master it - you MUST understand, what happens under the hood. Without understanding you can get relatively far, but other people will point at you and laugh.

    • @bf945
      @bf945 2 года назад +19

      Yep. C is just a high level form of Assembly. The output from many C compilers is an Assembly program which is then fed to the Assembler to create object code and then to the Linker to create executable code.

    • @arkeynserhayn8370
      @arkeynserhayn8370 Год назад +6

      @@bf945
      That the case with many (all?) compiled languages, but the thing specific to C is that since C is simple (not necessarily easy), its easy to reason about generated Assembly, specially if you have habit of reading Assembly listing file of some compiler, you get a general idea what assembly instructions your compiler might generate from some C code.
      This is what makes C so joyful to work with in Systems programming.

    • @traveller23e
      @traveller23e Год назад +6

      @@alexeynezhdanov2362 As a C# dev...no you don't. I routinely have trouble where I can't find anyone on my team who knows whether the performance of a LINQ statement will be better written one way over another, for example. In that environment, performance almost never comes up in consideration, it's all about how clear and maintainable the code is, and if it follows a set of arbitrary style guidelines that are defined vaguely enough no one can agree on (or even really cares) what they mean. Java's the same way...and when you add in front-end web development and consider a lot of backend stuff is written on the assumption that microservices or other tech magic will do all the optimization you need (I mean, to be fair most of the time is spent executing web calls anyway), that's a sizeable chunk of the industry that doesn't require any low-level knowledge for better or for worse.

    • @carltone
      @carltone Год назад +3

      @@traveller23e the discussions is about C not C# which is abstracted!

  • @notgin
    @notgin 2 года назад +15804

    Love how it ends with a seg fault, describes the C experience perfectly

    • @diskyariajetmiko
      @diskyariajetmiko 2 года назад +118

      What does it mean?

    • @mberoakoko24
      @mberoakoko24 2 года назад +762

      Seg fault almost cost me my last semester

    • @loganhello
      @loganhello 2 года назад +693

      @@diskyariajetmiko A seg fault is when you try to read or write to somewhere that you haven't allocated memory for.

    • @beefbox
      @beefbox 2 года назад +788

      @@loganhello not necessarily, it's read or write in memory that you are not allowed to read from/write to. You can read garbage from memory that you haven't allocated but that is undefined behaviour.

    • @aldi_nh
      @aldi_nh 2 года назад +60

      Ah, the memory

  • @scattonsimon6992
    @scattonsimon6992 2 года назад +3613

    Quick remark, gcc actually means GNU Compiler Collection and not GNU C Compiler, the name GNU C Compiler was dropped around 1999 (in April to be precise) because C was only one of gcc's frontend.

    • @Fireship
      @Fireship  2 года назад +988

      Good call, thanks for the correction

    • @scattonsimon6992
      @scattonsimon6992 2 года назад +180

      @@Fireship No problem! Keep up the good content!

    • @puppergump4117
      @puppergump4117 2 года назад +21

      @@Fireship You could pin him or something but everyone who searches for it will just type gcc anyways I guess

    • @pearz420
      @pearz420 2 года назад +14

      Yeah details like that aren't included in the first paragraph of a wiki page, so the youtuber missed it.

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

      @@pearz420 😂

  • @peppi69
    @peppi69 Год назад +127

    I still think C is the most perfect programing language. It's easy to understand to begin programing but has unlimited possibilities on what to build with it and it really runs on anything

    • @petergibbons607
      @petergibbons607 9 месяцев назад +17

      it's like driving a manual transmission, only the people actually good at it will be able to understand its greatness.

    • @shadowchasernql
      @shadowchasernql 8 месяцев назад +7

      yes compared to something like js it's a godsend

  • @oliverdixon4660
    @oliverdixon4660 2 года назад +493

    "Platform-dependent" in the context of compilers doesn't really imply dependence on a particular operating system; it means the native code is generated for a specified processor architecture, such as ARM or x86.

    • @Tachi107
      @Tachi107 2 года назад +99

      I'm theory you're right, in practice if you're going to use the standard library you'll likely be bound to the architecture AND the OS

    • @tiagodmota5840
      @tiagodmota5840 2 года назад +19

      Platform is OS + processor architecture. No?

    • @Unit_00
      @Unit_00 2 года назад +16

      I'm 99% sure this is wrong, since compiled code will use subroutines defined in ram by the OS, so an executable for linux won't work on Windows even if they are run by machines with the exact same specs

    • @oliverdixon4660
      @oliverdixon4660 2 года назад +6

      @@Unit_00 Well that's a different matter of binary formats and position dependency.

    • @davawen9938
      @davawen9938 2 года назад +6

      Well it depends, if what you want to do is emcompassed by the architecture, then the resulting assembly will be the same:
      (adding two numbers from the stack together)
      mov edx, DWORD PTR [rbp-4]
      mov eax, DWORD PTR [rbp-8]
      add eax, edx
      But if you need anything provided by the OS (so most things done by the standard library), the compiler output will probably be different:
      (exiting program, Linux vs Windows)
      mov eax, 60 ; sys_exit system call
      mov edi, 0 ; return code
      syscall ; equivalent to int 0x80
      mov ecx, 0 ; return code
      call ExitProcess ; WinApi function
      add rsp, XXX ; clean up stack

  • @hitlerssecondcoming2523
    @hitlerssecondcoming2523 2 года назад +976

    2:14 "Segmentation fault" - classic

    • @VivekYadav-ds8oz
      @VivekYadav-ds8oz 2 года назад +63

      ​@Z3U5 Different compilers have different behaviour, but GCC allows the implicit conversion, so (char*) isn't necessary. Plus, char on most systems is 1 byte, so though a good practice, not multiplying by sizeof(char) wasn't the cause of error either.
      The only thing I can think of is that his malloc failed to allocate memory, and hence he tried to access null + 1 address, which failed.

    • @NoNameAtAll2
      @NoNameAtAll2 2 года назад +58

      @@VivekYadav-ds8oz char is 1 byte on ALL systems, cause it's the "single byte"
      it's in the standard :)

    • @NoNameAtAll2
      @NoNameAtAll2 2 года назад +19

      @Z3U5 casting malloc result is not canonic C

    • @int16_t
      @int16_t 2 года назад +19

      @ZRU There is no problem with the original code he wrote unless he change it somewhere and didn't included it in the video.
      He never access any illegal memory address. void* can be safely cast to any type except a function pointer.

    • @Fireship
      @Fireship  2 года назад +486

      I left out the code that caused the seg fault, it was an intentional joke

  • @orco3847
    @orco3847 2 года назад +3230

    Actually, as opposed to C's neighbours, one can really learn all C's syntax in 100 seconds... 😂

    • @orco3847
      @orco3847 2 года назад +85

      @@naltun4702 💯 percent agree.. I had my suffering from C, then I moved to JS. Thanks GOD 🎶🎶

    • @socketbyte5348
      @socketbyte5348 2 года назад +201

      @@naltun4702 C is one of the few languages that require you to develop your own standard library to even use the language efficiently. Libc is just way too basic to be reasonable.

    • @schniemand
      @schniemand 2 года назад +107

      I think the *type* syntax of C is quite complicated and I've seen plenty of people get confused by it. I mostly mean declaration and use of anything that has to do with pointers.
      Pointers aren't complicated but the C syntax without proper explanation can make people think that they are.

    • @orco3847
      @orco3847 2 года назад +17

      @@schniemand That is why I wrote "C's syntax"..

    • @sadhlife
      @sadhlife 2 года назад +43

      @@orco3847 js is worse when it comes to complex stuff :^)

  • @martinstent5339
    @martinstent5339 7 месяцев назад +9

    One of my all-time favourite things is Exercise 1-23 at the end of chapter 1 in “The C Programming Language” It says “Write a program to check a C program for rudimentary syntax errors like unbalanced parentheses brackets and braces.” This at the end of the first chapter!! We only learned the very basics, and now Kernighan/Ritchie expect us to do that! I think I actually went back and did this exercise after reading chapter 5. But it still remains with me 40 years later as something that just seemed so “Wow!” …

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

      Same experience. Actually really like the book, by the time you read it you feel like you can actually write useful progtammes

  • @GuimoTheGizo
    @GuimoTheGizo Год назад +9

    C was my second language I ever learned. I find it kind of funny that your explanation of C is mostly what happens in the machine for _every language_ but that most people take for granted since so many popular languages have an interpreter and/or sandboxed environment holding their hand.

  • @victorpinasarnault9135
    @victorpinasarnault9135 2 года назад +1660

    12/10/2011: 10 years ago, Dennis Ritchie past away, leaving the world the legacy of the operational systems and the internet that we use today.
    He is the true legend, not Steve Jobs.

    • @cobaltno51
      @cobaltno51 2 года назад +19

      and alot of insecure, messy legacy codebases. C is certainly a huge accomplishement, but couldn't we just have bounded buffers? real strings? were those couple of bytes really too much? even as an optional addon?

    • @fredrickdenga7552
      @fredrickdenga7552 2 года назад +30

      He passed on with steve jobs yet few acknowledged him as compared to jobs

    • @adrianorocha-dev
      @adrianorocha-dev 2 года назад +296

      @@cobaltno51 Yes, those couple of bytes were too much in many cases back then. Today we are spoiled by super fast and high memory computers, but people literally counted the bits back in the day. Even C was considered a "heavy" language at some point.

    • @rajveersingh2056
      @rajveersingh2056 2 года назад +14

      Steve jobs is even lesser know than iron man.
      Point is, Having more than one legend is not a necessary for the world's existence.

    • @Supergecko8
      @Supergecko8 2 года назад +88

      @@cobaltno51 bro it's a 50 year old language

  • @pragyan394
    @pragyan394 2 года назад +551

    Ah yes the classic functions, print-fff and scan-fff

    • @mananasi_ananas
      @mananasi_ananas 2 года назад +35

      And fprintf, and sprintf, and fnprintf, and snprintf, and vprintf, and vfprintf, and vsprintf, and....

    • @whythosenames
      @whythosenames 2 года назад +14

      @@mananasi_ananas i love these now im going to call it ffffprintfff

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

      @@whythosenames sssnnprintfff

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

      Useless functions. All my homies use write() and read()

  • @yeahthebois3617
    @yeahthebois3617 Год назад +121

    Tip with malloc: if you cant remember how much bytes u need to store u can do malloc(sizeof([datatype here]) * [how much of those datatypes you want]) e.g:
    char* word = malloc(sizeof(char)*4)
    Now with chars its easy (1 char = 1 byte) however this technique works well when ur making struc arrays

    • @TheLoveMario
      @TheLoveMario Год назад +7

      If you need to initialize a string and know its length at compile-time just avoid the heap-allocation and do
      char word[4];

    • @unpatientes1562
      @unpatientes1562 Год назад +2

      i think in this case it's better to use calloc:
      str* word = calloc(4, sizeof(char))

    • @yeahthebois3617
      @yeahthebois3617 Год назад +2

      @@TheLoveMario that's cool until you have to access that variable outside of the function its initialised in.

    • @TheLoveMario
      @TheLoveMario Год назад +1

      @@yeahthebois3617 In a header file: char* word;
      Inside the function: static char a[4]; word = &a;

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

      @@TheLoveMario completely forgot abt that one there 😂😂😂

  • @Brawlstriker89
    @Brawlstriker89 6 месяцев назад +1

    I love that I can actually understand every bit of this video now! I watched this when I first started learning c++ about a year ago. I’ve now taken two computer science classes and a web authoring class for html, css, JavaScript. As well as a course in Microsoft power shell. Nice to see I’ve progressed. Lol

  • @poglord._
    @poglord._ 2 года назад +836

    If we look at the algorithm, next would be C++ in 100 seconds, C# in 100 seconds, Assembly in 100 seconds and finally Binary in 100. Last time in the react native, flutter and kotlin series, I predicted correct

    • @patrickmullot73
      @patrickmullot73 2 года назад +193

      that would be "Binary in &1100100 seconds"

    • @sharkinahat
      @sharkinahat 2 года назад +82

      If C was 100 seconds, clearly C++ must be 101 seconds, or 5 in base 10.

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

      What about Eiffel and Ada? Maybe, Pascal and Lisp even. Not to mention Algol and Smalltalk.

    • @rickdev1922
      @rickdev1922 2 года назад +14

      Quantum Mechanic inside Processor & Silicon Transistor in 100 Second

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

      @@patrickmullot73 epicccc

  • @shanebenning3846
    @shanebenning3846 2 года назад +517

    It blows my mind how much of the technology we depend on everyday came from Bell Labs

    • @thedrunknmunky6571
      @thedrunknmunky6571 2 года назад +67

      Truly a place with so many of the smartest people in the world.

    • @PhilipAlexanderHassialis
      @PhilipAlexanderHassialis 2 года назад +62

      Indeed Bell Labs and Xerox Parc technologies and invented paradigms are still either directly or indirectly used today - these people were the knee's bees. Amazing visionaries and engineers all of them.

    • @KookoCraft
      @KookoCraft 2 года назад +7

      @@PhilipAlexanderHassialis What I saw at Xerox Parc's graphical user interface demonstration was a regression. Its no longer "normal" to use a command line to get exactly what you want done, fast. It's all point and grunt like cave men.

    • @jeffesoncosta14
      @jeffesoncosta14 2 года назад +30

      @@KookoCraft If you dont like just dont use it.

    • @kanjakan
      @kanjakan 2 года назад +12

      @@KookoCraft GUI is better though.

  • @immanuelcharles2875
    @immanuelcharles2875 2 года назад +27

    It should be said that malloc/calloc allocates memory on the heap and you should only use free on heap allocated memory. Stack allocated memory will be deleted automatically after it goes out of scope.

    • @human-ft3wk
      @human-ft3wk 2 года назад

      Immanuel's talking about 0:52 I assume

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

      One could nitpick about your use of terminology.
      Objects on the stack aren't "deleted" per se. The language manages the stack automatically, without the programmer having to write code to do so explicitly, and this management is essentially just updating the stack pointer register. In some kind of vague sense when a function is exited and the stack pointer is changed to what it was before the function was called, that stack space is kind of "deleted", but that's a bit of a misnomer.
      (In C++ the use of that term would be more apt because in that case the language actually literally calls destructors for objects on the stack, and in this case "deleting" them would be an appropriate term to use, in a sense.)

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

    This helped me understand character arrays better and how pointers can be used for memory allocation that’s accessed through indexes

  • @justapugontheinternet
    @justapugontheinternet 2 года назад +892

    I remember writing an employees management system using C during my first year of university. Learnt a lot, including the fact that I don't wanna write C code for work.

    • @justapugontheinternet
      @justapugontheinternet 2 года назад +34

      @@mattmurphy7030 I admire your kind. The guys who write C code and do embedded stuff. I love it, but I just haven't had a chance to do it extensively. I feel like that's where the real stuff is at.

    • @gamerk316
      @gamerk316 2 года назад +39

      @@justapugontheinternet It is. That's pretty much what I do for a living. It takes time to get used to. That being said, with embedded processors being a lot more powerful than they used to be (the Cortex A53 is an industry favorite right now) we're able to splurge a lot more and go C++ rather then straight C, since we aren't as performance constrained as the days when we used 286's and 68000k's as our embedded processors of choice.

    • @toby9999
      @toby9999 2 года назад +16

      @@gamerk316 Not sure about you but I loved the 68000 architecture. It was so elegant compared to the x86 stuff. I've been fortunate to have been working with C and C++ for 25 years but now being pushed into the Java world, I'm hating it.

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

      @@toby9999 Go C# my friend.

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

      @@toby9999 what's your job

  • @ShashotoANur
    @ShashotoANur 2 года назад +63

    Being the mother, C deserves beyond 100 seconds

    • @salsamancer
      @salsamancer 2 года назад +6

      C is the big sister, assembly is the mother

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

      It is beyond 100 seconds. It's 145 second to be exact.

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

      @@salsamancer assembly is not even a high level language you can call it grandma

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

      @@OriMoscovitz hehe

  • @QxDEADBEEF
    @QxDEADBEEF 2 года назад +8

    2:19 I C what you did there.

  • @mu11668B
    @mu11668B 2 года назад +99

    Honestly C is one of the most amazing language I've ever used. Once you get through the concept of pointers, you'll find out how powerful they actually are. It's one of the most easy-to-use language to do simple parallel tasks without blowing up your memory limit.

    • @dtibor5903
      @dtibor5903 Год назад +8

      Don't forget how powerful memory leaks C does. I just did one yesterday.

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

      One of the most easy-to-use languages to do simple parallel tasks?
      Are you serious?
      Pretty much _any_ other programming language that has support for threads is simpler to use for parallel tasks than C.

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

      @@WarpRulez
      The nice thing about C is you can access the same memory chunks in multiple threads more easily. You don't have to call the mutex APIs if the threads are not going to work at the very same position in memory. I'm not sure about Golang though. The synchronization in Java is a bit convoluted but most of the APIs are nicer indeed. Running multi-thread in Python is nonetheless a nightmare. In many cases the GIL gets into the way and makes multi-threading meaningless (e.g. numpy arrays are managed by GIL in the version I used). In my project I had to get both temporal and spatial efficiency and C was the optimal solution to it.

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

      @@mu11668B
      That doesn't make C the easiest language to run multiple threads. It just makes it easier to access shared memory without mutexes.
      If that's the measure of easiness, then C++ is better on both fronts: It's very easy to create multiple threads (with 100% standard code, no need for non-standard libraries) and you can likewise bypass mutexes if you want. (And, in fact, the C++ standard library also offers support for efficient atomic variables. I don't know how many other programming languages do. And yes, C does too, I know.)

  • @abubakrakram6208
    @abubakrakram6208 2 года назад +689

    I think C’s easier than C++. With C++, you feel like you never actually finish learning the syntax. Ever.

    • @ananttiwari1337
      @ananttiwari1337 2 года назад +31

      yeah, exactly

    • @purple.requiem
      @purple.requiem 2 года назад +33

      I really hate it when I get weird errors.

    • @sxs512
      @sxs512 2 года назад +43

      You do finish learning the syntax. I learned most of c++ when I was in middle school in a couple of months. You just need a good tutorial and a lot of determination.

    • @abubakrakram6208
      @abubakrakram6208 2 года назад +23

      @@sxs512 I'm glad to hear it's possible. I've only been learning since September, so I think I've still got a bit of time to go. Most online tutorials are anemic, though, so I think I'll need to memorize the class textbook or something.

    • @purple.requiem
      @purple.requiem 2 года назад +3

      @@mattmurphy7030
      C++ gets freaking confusing when you learn about pointers. Segfault runtime errors are a pain on my arse

  • @JoolsParker
    @JoolsParker 2 года назад +67

    I was brought up on C - I bloody love the language (doing realtime embedded software and device drivers with it is a rollercoaster until you know what you're doing).

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

      The coolest thing I ever had to do in C was implementing sensory input on an Arduino microcontroller. It was a bizarre combination of bit manipulation, machine language, and regular C that you could only do in something as low-level as C itself.

  • @yapdog
    @yapdog Год назад +52

    Been programming in C for 3 decades, so, at this point, I can't even use a language that doesn't allow me to work with pointers and manage my own memory. And I'm better off for it.

    • @ghosthunter0950
      @ghosthunter0950 Год назад +8

      I learned python then C and now C++.
      It genuinely feels so much better to deal with the memory directly and you can be really creative with it. You have to know what you're doing though.

    • @zonictrout
      @zonictrout Год назад +1

      @@ghosthunter0950 same, I really like C/C++, more than python, even though it is much easier

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

      It depends completely on what you are doing.
      If I'm writing a shell script, for example, I couldn't care one iota about memory management, and I'm completely fine with the shell script interpreter doing whatever it does, as long as it does it correctly. Manual memory management in this context wouldn't make an iota of sense.

  • @slippydouglas
    @slippydouglas 2 года назад +9

    `char` is always 0-255. If you want a -128-+127 type, you’ll need the rarely-used `signed char` or more common `int8_t` type.

    • @asuasuasu
      @asuasuasu Год назад +1

      @scum bag worse: as far as gcc goes, on ARM it's unsigned, on x86-family it's signed.
      yet, char remains different from signed char and unsigned char to the type system :)
      nothing in the standard actually prevents `char` from being 16 bits... some obscure platforms (e.g. DSPs) may do that, but it can be assumed to be 8-bit for all typical platforms

  • @rifkyniyas122
    @rifkyniyas122 2 года назад +131

    Everyone: print ef
    Jeff: prin(t)ph

  • @KonKri
    @KonKri 2 года назад +26

    1:28 use *printffff* exactly what I thought to myself when I was a firstyear at uni😂

  • @RealValkor
    @RealValkor 9 месяцев назад +2

    I am a C# programmer and I recently started learning C to program with arduino. My prior knowledge of C# really helped me understand basic programming fundamentals and syntax. Both are definitely great and useful languages!

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

    Love videos like this to just get a general idea of what something is

  • @DannyBPlays
    @DannyBPlays 2 года назад +61

    That part about a string being an array of chars brought me wayyy back to early days in my university class learning C

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

      But did you ever create an array of characters without remembering to terminate it with a '/0'??? A noob move that everyone learning C has to go through 🤣

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

      @@JoolsParker '\0' not '/0' :D

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

      @@raunak1147 🤣 That’s the noob move that comes after realising there’s no terminating character!

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

      @@JoolsParker :o

  • @oskrm
    @oskrm 2 года назад +145

    One note, return + any number means non-success exit, you can then check what code was returned (exited) to figure where you returned that number.

    • @E231986
      @E231986 2 года назад +17

      YES. I was looking for this. Essentially everything in C that is seen as "FALSE" (not always but often defined by pre-compiler) equates to 0 (0x0, etc, not '0' though). Anything NOT "FALSE" (or !0) is seen as "TRUE" or essentially equal to 1. However, anything "TRUE" == 1 is not always true. It's tricky but the only real definition of "FALSE" should always equal 0 and anything non-zero is true.
      In extension to that, the only error code that means "no error" is 0 itself. Meaning your program ran perfectly with no issue/bug. Anything non-zero isn't necessarily an error, but any "non-flawless" execution. The nuance is necessary and this hasn't been stated enough in the comments (to my knowledge).

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

      yeah for example 137 is SIGKILL

  • @XX-ue6kj
    @XX-ue6kj Год назад

    🤣🤣🤣🤣🤣🤣. That last part killed me! That caught me off guard. That was so good! Im subbing just for making me laugh so hard. Thank you.

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

    I just love how Fireship
    instantly gets to the point and and stays true to the title.

  • @mesota2842
    @mesota2842 2 года назад +172

    Can we get a "Lua in 100 seconds?🔥"

    • @prasannasilva7754
      @prasannasilva7754 2 года назад +6

      Of course! my favorite programming language persuaded me to learn programming properly.

    • @softwarelivre2389
      @softwarelivre2389 2 года назад +10

      Oh, the forbidden language technique of the Hidden Brazillian village. A man of culture, I see.

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

      I was about to ask this

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

      @@softwarelivre2389 lol

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

      @@softwarelivre2389 While other languages were evolving by adding new keywords, the moon of tecgraf evolved by removing them

  • @manvesh97
    @manvesh97 2 года назад +454

    This makes me want to revisit C, didn’t like it when I learnt it at uni because struggled with pointers, but that all seems more interesting to me now!

    • @senkogaming4784
      @senkogaming4784 2 года назад +18

      ruclips.net/video/zuegQmMdy8M/видео.html I highly encourage you to watch it, I started learning C with this video. It isn't as hard as you think, you could maybe watch 30 minutes of this video everyday and then watch the Data Structures video from the selfsame youtuber. If you want to learn even more about it, then Jacob Sorber's videos are great too.

    • @5cover
      @5cover 2 года назад +30

      I started programming with C. It's not as hard as people say

    • @gabbagandalfjpr
      @gabbagandalfjpr 2 года назад +5

      what did you learn in this video that you haven't been taught at university? or is it just that you find it more interesting now?

    • @Supergecko8
      @Supergecko8 2 года назад +7

      C gives a lot of nostalgia hahahaha

    • @IngwiePhoenix
      @IngwiePhoenix 2 года назад +16

      C is actually really cool, just absurdly verbose, by design. And you can target just about anything.
      There is even SDCC, a C compiler that can, for instance, compile for the GameBoy!

  • @Tabvn
    @Tabvn Год назад +1

    C, c++ , and Go that is simple to learn and training your mindset and programming skills. Thanks for quick video but really useful!

  • @NotGarbageLoops
    @NotGarbageLoops 2 месяца назад +1

    The segfault in the end is a nice touch

  • @engel_e
    @engel_e 2 года назад +373

    2:04 if needed, you can mimic an object-oriented programming language approach in C by having function pointers inside a structure, which then would be accessible through the arrow operator. An instance of this structure could be compared to an object with its getters, setters and methods.
    Very nice video, I haven't used C lang for quite a few years and that's a great throwback with all those countless segfaults

    • @ccgarciab
      @ccgarciab 2 года назад +26

      iirc that's what they do in the Linux kernel

    • @dany5ful
      @dany5ful 2 года назад +11

      How would something like 'private' and 'public' work tho?

    • @IngwiePhoenix
      @IngwiePhoenix 2 года назад +11

      This is what SDL does, iirc.
      struct some_sdl_interface { func_ptr method; };
      struct some_sdl_interface* create() { ... st->method = method_ptr; ... }
      create()->method();
      I think SDL does that for a lot of its abstractions.

    • @bamberghh1691
      @bamberghh1691 2 года назад +17

      @@5cover opaque pointers can be used to hide details

    • @hamidcrazy9027
      @hamidcrazy9027 2 года назад +9

      Yep, do know that a lot of oop features are made using structures and function pointers

  • @gameglide9811
    @gameglide9811 2 года назад +30

    Came here in seconds!

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

      Same

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

      Same

    • @Fireship
      @Fireship  2 года назад +9

      Gold! 🥇

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

      @@Fireship your videos are always fire, this was just what I needed! You always exceed expectations!!

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

      same bruhh

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

    wow, superb explanation of what pointers are !!! Please, do more !

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

    Love your videos. Would love to see one for Ruby too!

  • @valerie4275
    @valerie4275 2 года назад +13

    That video, like always, was fantastic. I think it'd be quite interesting to see you cover one of the Lisp languages so Common Lisp, Clojure/ClojureScript, or even Scheme (in that case it'd most likely be Racket as many of the other Scheme implementations are too minimalist by themselves or are extension languages instead of general purpose programming languages).

    • @r.t.5767
      @r.t.5767 2 года назад +1

      Scheme is WONDERFUL! I'd watch a video if he made one

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

      Clojure! Clojure!
      Clojure is one of the BEST languages I've ever seen. It takes the good parts of functional programming & good parts of lisp while getting rid of worse parts. It works on JVM so you can use java libraries. Clojure repl and the tooling around it is amazing, the language really focused on the repl. You can even use the repl with clojurescript to run clojure code that then evaluates ON THE BROWSER IN REAL TIME LIKE BLACK MAGIC.

  • @DabbleCache
    @DabbleCache 2 года назад +5

    Literally began looking into C today for the first time. The timing of these videos has been oddly perfect.
    Thank you so much for these!

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

      Good fuckin luck fam

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

    This is one of the best, shortest but somehow very thorough explanation of this wonderful language

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

    very well done ! internet is also write in C . You can put pointer of function into your structure to be nearer of c++

  • @TheDerpiestSir
    @TheDerpiestSir 2 года назад +10

    Gcc actually stands for gnu compiler collection, it can compile fortran, ada, obj C, go and more

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

      That's crazy my dude but who asked

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

      @@darkforst17 I did

  • @supernenechi
    @supernenechi 2 года назад +25

    I always say I love Go, but the elegance of C is something that I just can't get over. It's so beautiful

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

      @@CrafterOfHacks Because they represent two completely different things. (.) is the "access" operator, i.e. access a field in this struct. the "->" operator isn't really unique, its actually a combination of two operators. "->" is equivalent to "(*).", as in "deference this pointer to get a concrete object and then access this element in this object". This is why they're two separate operators. "->" is used exclusively on POINTERS, i.e. references/addresses, while "." is used on CONCRETE objects. It allows you to look at code and quickly figure out if a variable is a reference (pointer) or concrete object. It also lets the compiler easily statically check the program, as it will detect if "->" is used with the wrong type and if "." is used with the wrong type. Languages that only use "." can't do that. Also, languages that only use "." generally don't have pointers. See: C# and Java.

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

      ​@@CrafterOfHacks I didn't know C# has pointers, but I would say that "." and "->" are both used very often and they're definitely not interchangeable because pointers aren't like references in C++, you can arbitrarily access a method without first dereferencing a pointer. I think it makes sense from a technical view, i.e. pointers must be dereferenced before using a method/member variable, and from a user point of view, i.e. "->" clearly indicates a pointer, "." does not.

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

      @@CrafterOfHacks The majority of people haven't actually done proper programming to know how problematic implicit type declaration is. It's very ambiguous and shouldn't be used when you have lots of incompatible variable types, especially when you want to have multiple *uninitialised* variables of different types.

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

    2:10 i like that example of program compilation and launching. What a good demonstration and nice example.

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

    I would have liked a comparison of the project development process compared to other languages.
    Going into dependency management and all the other stuff.

  • @achyuthcn2555
    @achyuthcn2555 2 года назад +6

    Would love a full course on C from you guys

  • @sominupadhyaya9026
    @sominupadhyaya9026 2 года назад +17

    That printf was smooth

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

    This was a very fun video! Any plans for more C content?

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

    pointers get me so confused, I'm glad you could explain then só easily and simple!

  • @thedrunknmunky6571
    @thedrunknmunky6571 2 года назад +8

    I had a great lecturer so he helped me (and a bunch of others) through the week or two it took for me to grasp pointers and arrow notation. After this, C became my favourite language to program in as I love how strict it is. And as it’s statically typed you know exactly how the data flows about in your program. And as long as you use them correctly, pointers make for very easy access to variables from anywhere in your program.

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

      Erm.... I would not say C is a strict language at all - you can REALLY screw stuff up with it. I saw it almost has a higher-level assembly language in some respects. Try looking at Ada for a strict language.

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

      @@JoolsParker true

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

      @@JoolsParker By strict I meant mostly that it was statically typed and it was my first statically typed language (I started programming only in uni therefore I was very late to programming). Being able to shoot yourselves in the foot is true though, as we all definitely have. However C is far more rigid, compared to vanilla JS, which is what a lot of viewers of this channel (including myself) program in.

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

      @@thedrunknmunky6571 If you enjoy the strictness of C, C++ is significantly more strict with types and casting. C++ has exceptions as well, so the shooting yourself in the foot stuff can be caught, like accessing outside of array bounds.

  • @sharangsharma203
    @sharangsharma203 2 года назад +12

    I used to hate it in college, but now later I realise that it provides the perfect balance b/w high level and low level stuff. The pointers stuff and similar low level details provide a great gateway to get into OS, linux, Networking and Compiler stuff.

    • @loriswit
      @loriswit 2 года назад +6

      we're in 2021, there are plenty of languages that provide full control on low level stuff while still being considered high level level languages, and which are also infinitely less painful than C

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

      @@loriswit which ones?

    • @loriswit
      @loriswit 2 года назад +6

      @@mccarthymalonza6500 I'd say it depends on which part of the low level stuff you need to have access to, but I suppose high-level languages like Rust or even C# could satisfy most of the these needs. On the other hand, you could use C when you explicitly need a low-level language that's as close as possible to machine instructions (e.g. when programming for embedded system with very limited resources), but then there's nothing "high-level" about it in my opinion.

    • @borgir6368
      @borgir6368 2 года назад +5

      @@loriswit literally no one use C# and rust for low level

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

      @@borgir6368 People do use Rust for low-level things. For example, Redox OS is an example of an operating system written in Rust, and the Linux kernel is adopting Rust for writing some drivers in. The point they were making is that most people don't actually need to use C; C# or Java would still give good performance while being much nicer to program with, because they offer garbage collection and built-in conveniences like inheritance and lambda expressions, and they hide pointers from you so you don't shoot yourself in the foot.

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

    I *still* get confused by const and const ...

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

    Great video. GCC stands for GNU Compilter Collection. Although it used to stand for GNU C Compiler in the past.

  • @franciscogilt
    @franciscogilt 2 года назад +7

    Fireship videos are like a knowledge pill for your brain. Simply awesome!

  • @rickbhattacharya2334
    @rickbhattacharya2334 2 года назад +15

    C is by far one of the best language . Even after so many years and so many languages later it's still very useful .

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

    It's my favorite language, plain & simple but still very eloquent to write.

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

    that "c" mad me subscribed. great work!

  • @barbyboi
    @barbyboi 2 года назад +9

    "and i will c you in the next one"
    Why did i knew you were going to say that as soon as i clicked on the video xDD

  • @timboooh
    @timboooh 2 года назад +13

    "Segmentation fault" ah yes, the C language

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

    This video and the 'in 100 seconds' series is nothing short of magical...

  • @marvinkuznitz6250
    @marvinkuznitz6250 Год назад +3

    I was in college studying computer science circa 1980. For programming we were studying FORTRAN and IBM OS360 assembly language. A friend of mine was interning at Bell Labs and he said he was learning a language that was so much better than FORTRAN called "C" and an operating system so much better than IBM OS 360 called "UNIX". After being a professional FORTRAN programmer for a number of years I started to use C and it was so much better than FORTRAN and the whole developer environment was miles ahead of anything else at the time.

  • @MrChester114
    @MrChester114 2 года назад +9

    I love that in C you have no classes. I think separating data from functions makes any program cleaner and easier to understand.

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

      You can implement OOP in C but you should not

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

      I agree for most cases, but I will say containers especially lend to object oriented programming very well. Having lists, vectors, trees, etc. with methods to act on their own data is intuitive and very concise. list.size() and vector.size() have completely different code, but they have the same name and represent the same thing - the size of a container. It really makes it simple to abstract and encapsulate complex data structures with complex memory allocation and traversal into objects as simple and easy to use as arrays. OOP also lends well to GUI parts of applications, as polymorphism and inheritance represent GUI components and widget hierarchies very well.

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

      ​@@lucass8119 I can agree about containers. I don't know about GUI programming since this is not my field. I guess the best approach is to use classes where they really fit and not everywhere. Having everything as class never works from my experience. Instead of focusing on the task that your program needs to do you focus on creating object hierarchies. So for example whether message should send itself or there should be a sender object that sends messages.

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

      @@MrChester114 I agree 100%. The "everything is a class" sort of idea that we see in Java and others is dumb and needlessly complicated. Most things don't need classes and objects, and you should only use OOP if it makes sense for that specific problem.

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

      And I think you've never tried writing anything longer than 100 lines of code. If you did you'd know that using objects and oop concepts like polymorphism and encapsulation is the way to go.

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

    This was great! Could you also cover how to setup a build file? I always struggle with those for more complex projects that use more a couple of files.

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

      Makefiles are a little like a backward chaining AI program.

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

    I joined a programmation school since more than a month and worked 50h per week on C language, I am an absolute noob in programmation, it is an amazing experience and I am glad to see how much things I can do compared to the very beginning but jeez that's hard for me.

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

    Wow this video compresses of everything I've learnt in the past 1 year

  • @kzm1934
    @kzm1934 2 года назад +10

    Anybody who wants to learn C should read the K&R book. It's brilliant and has everything you need.

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

      I kinda want to, but it's so old. I got Effective C which covers c17 and possible C2x.

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

      Please, don't recommnend it to beginners.

  • @dulanchampa
    @dulanchampa 2 года назад +10

    Oh god, the "printfff" killed me 🤣

  • @mushrafaltaf
    @mushrafaltaf 2 года назад +8

    I enjoyed C so much. I recommend everyone to try C, you will just learn a whole lot about how computers work.
    Edit: You can C how the computer works, ta dum tiss.

  • @HichigoShirosaki1
    @HichigoShirosaki1 5 месяцев назад

    Here I was anxious about learning C in my future college courses after having done Java and Python, but if it's really that straightforward, then I am very much relieved.

  • @crusaderanimation6967
    @crusaderanimation6967 2 года назад +6

    Languages with garbage colection: Don't worry about memory management, I got you covered and I will protect you.
    C (and c++) :You're on your own kid... Have fun.

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

      Honestly, managing memory yourself is kinda fun

  • @ogamiitto5642
    @ogamiitto5642 2 года назад +15

    Nice video!
    One small nitpick though: one should never write functions with completely empty argument lists in „C“, as the compiler takes this to mean that the functions in question can be called with a variable number of arguments (of nearly arbitrary type).
    Taking your example of a completely innocently looking “int main ()” function, this means that it would perfectly valid to recursively call this function-for example-like so: main(1, 'A', 3.7, "unintended consequences");
    Thus, if one is not interested in doing any command line argument processing (at all), a programs entry point should always be written like so:
    int main (void) { ... }
    Admittedly, this may change with the next version of “C”… however, until the final standard for C2x is released, the above rule stands as described.

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

      Is It a problem to allow a variable Number of arguments to the main, if you won't use them after?

  • @abhisheksathe123
    @abhisheksathe123 Год назад +1

    I still remember when I was in diploma college and our computer lab did not have code editors so there was this Turbo C program installed on all PCs which had like the old school 4:3 aspect ratio and the UI was basically like how old PC BIOS was like everything was operated via keyboard. It was a fun time writing simple addition or find factorial of a given number type codes.

    • @destroreact5706
      @destroreact5706 Год назад +2

      Oh yeah, that thing with blue background....holy sh*t that brings back memories

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

      My high school programming class used Turbo Pascal from the same company, so many great memories! Back when a full compiler and IDE could fit on a 3.5" floppy.

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

    This was actually surprisingly concise.

  • @wouterzonneveld2305
    @wouterzonneveld2305 2 года назад +15

    I think the 6 dislikes so far didn't take those "C" puns at the end too well.

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

      Nah, those are just stray GCC errors :P

  • @lupuscanis4370
    @lupuscanis4370 2 года назад +9

    "C does not support OO" if you know how to use C you can make OO it is hacky but you can.
    There is a book, "Compiler design in C" that all their examples are written in C, and explains how the code is OO.

    • @donjonmaister
      @donjonmaister Год назад +1

      It certainly is possible. When I was in my data structures course, I was the only crazy person who did the assignments in C (linked lists, binary trees, dynamic queues and stacks, etc.) Objects are just structs with function pointers.

    • @MrjinZin0902
      @MrjinZin0902 Год назад +1

      that's mimic. not support. It is possible to write C code in style of OOP. but that's not OOP. OOP is how you organize data and OOP languages provide syntax for that concept. but C don't provide that syntax. you have to make up oop structure from the scratch and then you have to stick to that style. you can't expect other programmer to stick to that style. if you need to work with other people then you need a lot of document. that's why we don't call C OOP language.

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

      @@MrjinZin0902 OOP is a philosophy, not a language. Back to noob class with you.

  • @BibleClinger
    @BibleClinger Год назад +5

    I love C. Sometimes I think it just needs a simple push in the right direction to make it better as a language, but its fundamental essence is that of a language that is just so very simple, fast, and beautifully expressive. It's also incredibly dangerous. I still love it.

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

    Love your videos, they are a great wta to learn, Please make a C++ in 100 seconds video!

  • @CoentraDZ
    @CoentraDZ 2 года назад +10

    Respect for C, the father of my favorite programming language.

    • @boggless2771
      @boggless2771 2 года назад +14

      "Do you have the slightest idea how little that narrows it down"

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

      C++ it is

  • @AGBuzz182
    @AGBuzz182 2 года назад +14

    The video implies that the stack has to be managed manually, but this is not true. If you declare a variable int phone_number, the memory for it will be automatically deallocated when the function containing it returns. This does not require garbage collection.

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

      I was in doubt with that detail, thanks for explaining!

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

      It isn't deallocated. Such variables are created on the stack, when the function returns that variable is out of scope, but can still be accessed by evil people until something else overwrites it, assuming it wasn't optimized out of existence by the compiler. Accessing something deallocated would cause a segmentation fault on a modern OS, where as accessing an out of scope variable is just evil.

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

      @@bur1t0 Fair point, and this can be the source of very subtle bugs if you're careless! It isn't deallocated in the sense that it's no longer mapped to the program's address space, but as you point out, it is no longer reserved for the data it contains and can be overwritten by the runtime, meaning it should probably for all intents and purposes be treated as strictly deallocated regardless.

  • @damonmlinaric9254
    @damonmlinaric9254 3 дня назад

    I just started cs50 earlier this week and hearing that c is one of the more simple languages is definitely not what i wanna hear but are well wish me luck.I feel like once i wrap my head around how to solve problems then everything will kind of be about practice and ill have a much easier time learning

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

    Learnt all these. Forgot all these. Now I'm happy !

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

    Do Assembly next.
    Wanna see if you can contain it 100 seconds. Maybe stick to x86 ASM, but most ASMs are kinda similar.

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

    C

  • @ankurpanda9746
    @ankurpanda9746 6 месяцев назад

    Thanks man, I knew nothing about C and I have my Semester Ending Examination for C in 5 minutes time. I hope this will help me pass the exam.

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

    gcc is still the dominant compiler in opensource spaces but these days clang is getting a lot of adoption, with it being the default on macOS, the only option for iOS, and an easy option to select on many Linux distributions. Plus, it's the basis of a lot of new languages' compilers and often the first choice for folks designing new instruction sets due to its much more modular nature than gcc.

  • @Supergeckos1000
    @Supergeckos1000 2 года назад +14

    0:50 That is a bit misleading, because the manual freeing only applies to dynamically allocated variables

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

      Yeah, primitive types exist on the stack and are effectively freed as the stack returns up. Fireship is not a C programmer

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

      @@kevincahalan8118 Non-primitive types can too be allocated on the stack; on the other hand, primitive types can also be allocated in the heap

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

      @@Supergeckos1000 Primitive variables*, in other words stack variables

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

      @@kevincahalan8118 just call them auto variables

  • @mathgeniuszach
    @mathgeniuszach 2 года назад +7

    You don't need to use malloc unless you're dealing with arrays of variable size at compile time. Seeing malloc(4) makes me feel awkward.

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

      This. People not familiar with C tend to misunderstand/overestimate garbage collection. Not EVERYTHING has to be malloced & managed; like 90% of stuff can use just normal stack variables (or for things like hardcoded char*, live in the data section). E.g.
      char* str = "hey";
      printf("str is '%s'
      ", str);
      The only times you actually need to malloc the variable is if you want the variable to survive beyond the scope of the function, or (like you said) you don't know at compile-time how many instances you're going to use (e.g. if you were writing a browser in C, you'd malloc for every tab opened, cause you don't know at compile-time how many tabs the user is going to use; that's an indefinite/variable number).

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

      @@CrafterOfHacks Thanks for correction. Fixed.

  • @waliqadri
    @waliqadri Год назад +1

    C language has its own type of warmth and love in it.

  • @filmfortbe
    @filmfortbe Год назад +1

    I would love to see a video about CMS's (Headless CMS"s, Wordpress, Drupal, etc.)

    • @user-ts7of5to4e
      @user-ts7of5to4e Год назад

      Helpline📲📥⬆️
      Questions can come in⬆️