Thread: c and c++

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    4

    c and c++

    hello, i'm a newbie.

    are c and c++ really similar?
    some people say that they are extremely similar, and taking the path of learning c first is better.
    i'd like to learn both c and c++. which one is better to start with?

    and as i mentioned before, i don't have any programming experience. would alice be helpful?
    Alice.org
    Last edited by honeythigh; 03-05-2011 at 07:38 PM.

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    There have been plenty of threads discussing this here. Seek and ye shall find.

    Learning two languages at once is usually not a good idea. Learn one, learn it well. Then look at learning the other one.

    Practically, if the two languages are C and C++, it doesn't really matter which you learn first. Either way, you will need to unlearn some things from the first language (and associated library) that you learn, and learn new things in the second language.

    The argument "C is a subset of C++, so is easier to learn" is a fallacy. Apart from the fact that C has never been a pure subset of C++ (there are some things in C that are not C++, and vice versa), effective C programming involves using techniques that no self-respecting C++ programmer will use. Similarly, C++ programming involves using techniques that are either not available in C, or that no self-respecting C programmer would employ.

    This is not because either language is better than the other, but because they are designed with different trade-offs.

    In the end the choice of "which first" will normally be based on the work you expect to do: if working on a C project, don't bother learning C++, or vice versa.

    If you simply want to know both, simply pick one, and learn it well. Then go through the unlearning and relearning phase in order to learn the other.

    There is a gotcha that a lot of compilers support both languages. You will not learn the difference between C and C++ by feeding code to a compiler, as a lot of C++ compilers accept C-specific constructs and a lot of C compilers accept C++-specific constructs (the joys of "compiler extensions"). That overlap is a quality of implementation concern with modern compilers that bites people who wish to keep aware of the differences between C and C++. So if you want to avoid the trap of writing in a hybrid language (eg writing code that is C with some C++ extensions, or vice versa) pay very close attention to your textbooks and learning guides. You can't trust documentation that comes with compilers for that - if a compiler blurs the distinction, usually its documentation and help files do as well.
    Last edited by grumpy; 03-05-2011 at 07:56 PM.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  3. #3
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    In the other thread, you said you were excited (or something) to start learning C++.

    You should start with C++. If nothing else, that attitude will help you get further than trying to learn something you aren't excited about.

    Soma

Popular pages Recent additions subscribe to a feed