C vs C++ What is different?

Sdílet
Vložit
  • čas přidán 30. 04. 2023
  • C vs C++ the differences explained simply
    If you want to learn C++ I'd recommend this website
    hackingcpp.com/index.html

Komentáře • 32

  • @Labs51Research
    @Labs51Research Před 6 měsíci +68

    40 years programming with C and about 35 with C++ .. in my humble opinion, C is the only language you need.

    • @TheBuilder
      @TheBuilder  Před 6 měsíci +13

      I'm spoiled by the abstractions C++ offers out of the box, the standard library is just another layer that keeps me coming back

    • @exception05
      @exception05 Před 3 měsíci +6

      Thanks for the opinion, kind senior. I have a 15 years experience in IT, but not in programming (did couple projects in C++ before just for fun) and I was looking to choose just the right language to implement own neural network application with custom algorithms. After a month of investigation, I saw that C++ is a good solution, but then I realised that C is really enough. And what I never realised that this language is so portable. Need a iOS application? You can import C backend code into Swift. You can call C through JNI in Java, you can always import C into Go language and surprisingly - in C++!!1 :) Or even Objective-C. Or... who knows what.
      Also I found that Lua script is a pretty good addition to knowledge of C and C can include Lua, and Lua can include C. It's not like I really need Lua, but still a nice option for prototyping. Well, at least it's performant, can be embedded, etc. And it can help to switch paradigms of coding.

    • @skigui1
      @skigui1 Před měsícem +1

      Thanks 👌👌😁

    • @CaptTerrific
      @CaptTerrific Před 16 dny

      I tend to use C++ as a smart pointer "extension" to C and nothing more - let's me program as though I'm using C, but offers a pleasant CYA for memory management that saves me a ton of time :)

    • @SpazeOfficial
      @SpazeOfficial Před 2 dny

      What do you program?
      Games?

  • @fcolecumberri
    @fcolecumberri Před rokem +23

    A lot of people think of C++ as C with classes (which was the original idea), however, if I would be asked about the biggest strengths of C++ over C, I would not bother talking about OOP, it is true that for a while OOP was considered the algorithmic silver bullet, however, now a days, it is only used in the places where it is a good solution. I considere that the main reasons to use C++ over C are constexpr (which let you create code that can be solve at compile time) and templates which allow to create meta-programming without void* (here I would include the entire STL and other template libs out there), that if done wrong, compile time errors will appear (instead of run time errors with void*) and can be optimized at compile time.

    • @TheBuilder
      @TheBuilder  Před rokem +9

      well, I feel there's a slight difference between OOP and classes. C does not have RAII which means I can't build abstract data types which clean up after themselves, this makes C simpler to learn but harder to use which is a trade off. I'm a big fan of using all the features of C++ but I have to be fair and say that the average person won't be able to learn C++ in a month, this is the opposite of C which can be learned in a month or two.

    • @skillfulmind960
      @skillfulmind960 Před 5 měsíci

      ​@@TheBuilder❤

  • @IgorLisx
    @IgorLisx Před rokem +18

    I think it's very possible to replace C with C++ everywhere. If you don't need something, just don't use it in C++.

    • @TheBuilder
      @TheBuilder  Před rokem +26

      good point, I think many places use C because it produces a much smaller binary plus the language is much simpler which makes debugging easier for developers.

    • @makara2711
      @makara2711 Před 8 měsíci +11

      The most brilliant, most influential, and smartest computer scientists (Ken Thompson, Dennis Ritchie, Linus Torvalds) DISLIKE C++

    • @lennymclennington
      @lennymclennington Před 7 měsíci +12

      @@makara2711 Modern C++ is completely different to the C++ that they probably dislike.

    • @makara2711
      @makara2711 Před 6 měsíci +3

      @@lennymclennington no, Ken specifically made GO because they (he and his team) decided they hate C++
      As for Linus, no question there.
      Not sure whether Dennis would've changed his opinion about C++, but think about it, he designed C and later said that he disliked C++.

  • @GmanGavin1
    @GmanGavin1 Před 5 měsíci +6

    I don't know, I think the key word here is "discouraged". To me all the coverage in C++ seems like (opinions of how you should write) rather than a required (need to write).
    I feel like similar videos kind of oversimplify this into facts when a lot of C++ seems optional. Feel free to correct me.

  • @IgorLisx
    @IgorLisx Před rokem +9

    Please do not stop creating new videos. Keep adding wisdom and knowledge to this world!

  • @eng.shh80
    @eng.shh80 Před 2 měsíci +1

    You’re partially right, C is not a subset of C++ but C++ is the extension of C.

  • @lennymclennington
    @lennymclennington Před 7 měsíci +1

    I would not say that the "custom" is to use a method like obj.f() instead of f(data), the "custom" is to use whatever makes sense. And a lot of the time, POD with no functionality attached as methods does make sense, and so you'd use a free function. The actual difference is that C doesn't give you a choice, you only have free functions, whereas C++ gives you the choice of using methods or having a POD type that is passed to a free function.

    • @TheBuilder
      @TheBuilder  Před 7 měsíci +1

      using a POD is also an edge case, most of the time you'd want to write a complete class

  • @garryalfonso1609
    @garryalfonso1609 Před 6 měsíci

    The video so short... Craving for more info like syntax... Can you make another video about c vs cpp and their syntax difference and similarities? Thanks bruh...❤❤❤

  • @wastedkafir9134
    @wastedkafir9134 Před 6 měsíci +1

    smart ptrs were there in c++ even before c++11 called auto_ptr

  • @saltygoose2943
    @saltygoose2943 Před 14 dny

    So, this may be off topic but the career center at my college recommended that I added C to my skills section because a course that we went through does use c++. So the resume the worked on with me says c/c++ which if someone like yourself was looking at my resume would just know is incorrect. I’m literally taking this argument to them on Monday and showing them that the recommendation is probably getting people looked over for jobs.

    • @TheBuilder
      @TheBuilder  Před 13 dny

      I've seen recruiters write C/C++, so I doubt it matters

  • @TheAndiKurz
    @TheAndiKurz Před 7 měsíci +4

    C++ is somehow a low level and a high level language at the same time.
    But C is a subset of c++, because you could just compile c code with the c++ compiler and it would work perfectly fine, this is not recommended, because the c compiler would make some more specific optimizations, but the program should run as intended.

    • @lennymclennington
      @lennymclennington Před 7 měsíci +8

      C is not a subset of C++. It is very simple to write a C program that won't compile in a standards-conformant C++ compiler

  • @leshommesdupilly
    @leshommesdupilly Před 6 měsíci +1

    Me writing c code and calling it cpp just to watch the world burn down

    • @guilhermeteixeira5898
      @guilhermeteixeira5898 Před měsícem +1

      No way.. I'm really afraid of you :o
      LOL you just want to see world burns, am I correct?

  • @fpn12099
    @fpn12099 Před 7 měsíci

    You totally forget the most important difference.

  • @TheSeaOfAsher
    @TheSeaOfAsher Před 3 měsíci

    low level systems programming.

  • @skigui1
    @skigui1 Před měsícem

    "C is simple" 😂... c++ harder than c, js harder than rust