Is learning C/C++ worth it?

This is a discussion on Is learning C/C++ worth it? within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Hey everyone, I've always wanted to start learning C++ and I love programming. A few weeks ago I downloaded some ...

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    10

    Smile Is learning C/C++ worth it?

    Hey everyone, I've always wanted to start learning C++ and I love programming.

    A few weeks ago I downloaded some tutorials and in a few hours I could write some nice basic programs with loops etc.
    I'm planning on reading some C++ books this vacation and learning C++ from the ground up. I've got previous experience with programming in form of Java.

    So, I was wondering is there any drawback to learning C++ and not knowing C?
    I know C++ is the superset of C but still, why would I learn C when I could learn C++?

  2. #2
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    No need learning C first Or so a tutorial told me...
    Currently research OpenGL

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,338
    C and C++ are different languages with different approaches, different uses, and different tools.

    If you want to learn C++ well, you'll be learning a lot of things that you wouldn't do or would do differently in C. So learning C is a completely separate task from learning C++.

    It is beneficial to learn many different languages, but I wouldn't necessarily suggest doing several at a time. There's not really any good reason why you should learn C with or before C++, and some people would even say that learning C first is a detriment because it teaches you habits that you would want to avoid in C++. So I'd say stick with C++ now by itself. In the future, you can broaden and deepen your understanding by learning C, assembly and lower level languages as well as other high level languages.

    If you do want to learn modern C++, I'd be careful about which book(s) you use. Most books still teach C-style C++, so to get the most out of learning the language you'd probably want to go with those that teach the more modern style.

  4. #4
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    I know C++ is the superset of C
    It's being picky, but basically the answers above are correction your error in this statement.

    C++, as the name suggests, was developed as an incremental change to C - but they really have become 2 separate language, even if they are very similar, and even if for the most part, this statement is pretty much true)

    Most books still teach C-style C++
    True. My first book taught C++ in 2 parts. The first one was called "The Basics" or something similar and the second was called, "Object Oriented Programming in C++". Looking back now - Part 1 was pure C. Part 2 was just C with classes (incidentally - the original name of C++).

  5. #5
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Depends on what you need the language for.
    Java is closer to C++ than to C. So, you would broaden more, in a way, your knowledge if you learned C.
    If you know Java and learn C you can easily learn C++ to add more on your knowing languages.

  6. #6
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    It's definitely worth learning both.

    I know others disagree, but I now recommend C over C++. Yes, there are drawbacks, which Daved mentioned. I feel like if you have a good head on your shoulders and actually enjoy programming, then you can be self-aware of those problems and avoid those habits. If you're somebody who is learning for work, or money, and doesn't care, then it's different.

    The reasons are as follows:

    1) As a beginner you are going to be prone to procedural programming. It's the way a beginners brain is wired. Even if you start out in C++ or Java, you will still treat code the way you would without OOP, but instead wrapped inside members and methods ("bad OOP"). Look at any beginner who starts their own game in C or C++. It's always extremely bad.

    2) Most of the libraries you will use in C++ are written in C (for compatibility mostly), and you will have abstracted low level procedural non-OOP code no matter what. Choosing C++ over C isn't going to save you from this.

    3) C is a lot easier than C++. They are both easy to learn, and hard to master, but C++ is a level or two higher. I'm not talking about classes, not even multiple inheritance, but you're immediately into operator overloading, generics (templates), scopes, static classes, patterns (singleton, observer, etc.), macro templates, polymorphism, STL data structures (without knowing how they work behind the scenes), and those are the basic topics.

    4) There's obviously less keywords, features, and learning required in C. C is mostly about the libraries. You can learn C and basic libraries considerably quickly in comparison to C++.

    5) In a way, C makes you think more about what how the underlying system works. You don't just add something without knowing how it works. I'm mostly referring to strings, memory, io, classes, etc. Each of those have pre-requisites you learn in C.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  7. #7
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    There is nothign 'beginner' about procedural programming. While it does tend to be easier to grasp for beginners, it also provides the best performance if done correctly. I've been programming for nearly 30 years, and still mostly code using procedural style. Obviously there are times when its not appropriate, such as writing tools and libraries, but just because a hammer can't do the job of a screw driver, doesnt mean a hammer is a beginners tool, because a screw driver cant do a hammers job either. Each programmign style has its own strengths and limitations. A good programmer uses them all when they are most appropriate and doesnt get into the rut of using one style preferentially.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  8. #8
    Registered User
    Join Date
    Jan 2005
    Posts
    7,338
    Referring to something as a beginner's tool does not imply that it cannot also be a tool for advanced users.

  9. #9
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    As noted, C++ is C, so good knowledge of C++ entails knowledge of C.

    It also depends on your long-term goals and interests. If you're more focused on design principles (i.e. Soft-Eng) and are content to leave the hardware as abstracted, then C++ is the way to go. If you'd like an in-depth understanding of computation from architecture to design then starting with C would be preferential.

    My personal recommendation would be C->C++->Java/C#. Why? Because you need a solid foundation in order to really grasp what's going on behind the scenes in any super-high-level language (as in Java/C#). Priority one is memory management: the kind that you just won't get from using new/delete or automatic allocation; you've got to sweat it out with malloc to fully appreciate what's going on.

    A bit of a warning though: compared to the hand-holding of Java, C (or even C++) is going to get a bit hairy some times. In a nutshell, C is about not shooting yourself in the foot while holding a greased-up .22 caliber magnum.

  10. #10
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Nope

    How do you like them apples?

  11. #11

    Join Date
    May 2005
    Posts
    1,041
    Programming is way too hard.
    I'm not immature, I'm refined in the opposite direction.

  12. #12
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    I dont think that Java>C# is necessarily a logical progression from C>C++. If Java and C# are what you will end up using, there is really little if any need to learn C or C++ for THAT purpose, although they will certainly give you more perspective on OOP in general, its not a bare necessity.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  13. #13
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    C# is more like the Java transitioning into $.

  14. #14
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    > My personal recommendation would be C->C++->Java/C#.
    My recommendation is similar, C -> Java -> C++

    A lot of the concepts in Java are the same in C++, but far easier in Java and thus you'll be able to apply/expand on that when you learn C++.

    My theory of course, so feel free NOT to bash me
    Last edited by zacs7; 11-03-2008 at 07:02 PM. Reason: I want to see my theory get bashed. Just not me ;)

  15. #15
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    >> My theory of course, so feel free NOT to bash it

    But... but... I want to throw in pedantic arguments. You did already thwart my efforts by being polite, however.

Page 1 of 3 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Learning game programming worth it?
    By taver in forum Game Programming
    Replies: 6
    Last Post: 07-04-2009, 11:07 AM
  2. Machine Learning with Lego Mindstorms
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 01-30-2009, 01:34 PM
  3. Need Help On a Simple Bank Program
    By oobootsy1 in forum C# Programming
    Replies: 9
    Last Post: 08-08-2005, 10:51 AM
  4. Is it worth the time....worth the sacrifice?
    By Leeman_s in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 05-04-2002, 06:33 PM
  5. API learning reference (for those who are learning)
    By steve_i83 in forum Windows Programming
    Replies: 1
    Last Post: 11-04-2001, 12:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21