TechSpot

Difference between C and C++

  1. I was not sure where to put this so forgive me if it belongs elsewhere.

    I would really like to know because I wouldn't mind learning one. If you could recommend one to learn that would be great too. I hear its similar to Java which I learned a tiny bit of last year.
     
  2. direwolf007

    direwolf007 TS Rookie Posts: 105

    First of all, the (rather silly) operator joke goes that C++ is called "C++" and not "++C" because it runs slower, yet returns the same functionality...

    On the surface, Java and C++ might look the same, but Java is much simpler, for three (main) reasons:
    1) Java comes with extensive libraries which do almost anything you can wish for - And these are standard. C++ on the other hand has very little as far as standardization goes.
    2) Java is platform independent, C++ is not.
    3) Much is hidden from the programmer, such as memory management.

    This is not to say Java is better than C++, or vice versa (anyone arguing either point is acting silly - both have their places).

    C is the basis of C++, and serves as a good starting point to study the latter. Unlike Java, C is not an Object Oriented language, so writing in it is different and not tied to the class/object concept. I would recommend at least getting slightly acquainted with C before trying to learn C++, although it is not an absolute must and the two differ in their standard libraries, Input/Output concepts, memory allocation/deallocation and other things.
     
  3. CombinationZero

    CombinationZero TS Rookie Topic Starter Posts: 31

    Thanks, That helped a bit as did the IRC channel :)
     
  4. NetCablesPlus

    NetCablesPlus TS Maniac Posts: 228

    FYI, another consideration is what you plan to use the code for. For example, it is very, very rare for an embedded systems programmer to use Java in an application due to higher overhead issues. They tend to use C or C++ to keep memory requirements as low as possible. Some times they still use BASIC for this reason. By the way, by "embedded systems" I am referring to code that doesn't run on a traditional computer, but is used in other electronic devices (e.g., automobiles, refrigerators, etc.)
     
  5. direwolf007

    direwolf007 TS Rookie Posts: 105

    I haven't heard of using basic for embedded applications, but Assembly coding is commonplace in the embedded world (like the coding I do at work, for example). Another reason why Java won't be used in many embedded systems is the fact that there is no JVM for most of the microcontroller architectures out there.
     
  6. NetCablesPlus

    NetCablesPlus TS Maniac Posts: 228

    Oops...I meant Assembly...wrote BASIC...sorry...good catch direwolf...

    About the JVM: I used to sell RTOes and TCP/IP stacks for 8-bit, 16-bit, and 32-bit processors. We looked into offering a JVM, but the overhead was too much for all but the largest 32-bitters.
     
  7. captaincranky

    captaincranky TechSpot Addict Posts: 11,707   +1,887

    I'm About to Make Mark Twain Proud........By Erasing All Doubt.....

    I don't need to go into the whole quote, do I?

    I thought that assembly code was processor specific. (!) or (?) (multiple choice) I distinctly remember not being able to program an Atari 1200 with it.

    What does Python do? I always hear that name kicked around somewhere near Firefox.
     

Similar Topics

Add New Comment

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...