C and C++ difference

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kartik21
    New Member
    • Aug 2008
    • 1

    C and C++ difference

    what is the difference between C and C++ Compiler...i don't think there is any difference but if it has please tell me...
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    A C compiler compiles source files written in C

    A C++ compiler compiles source files written in C++


    There is a sub-set of the 2 languages C and C++ that is understood by both compilers, it is therefore possible to write code that can be compiled as C or C++ if you really wanted to. However most people don't bother, they either write in C and compile in C or write in C++ and compile in C++ in some cases using both languages in the same project (although right at this moment I can't think of a good reason for doing that).

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by kartik21
      what is the difference between C and C++ Compiler...i don't think there is any difference but if it has please tell me...
      If there is no difference between the two it is quite silly to give that one and only
      language two different names. Please read your literature first before you post
      questions like this.

      kind regards,

      Jos

      Comment

      • donbock
        Recognized Expert Top Contributor
        • Mar 2008
        • 2427

        #4
        Originally posted by kartik21
        what is the difference between C and C++ Compiler...i don't think there is any difference but if it has please tell me...
        There are some compilers out there (such as gcc) that are capable of compiling either C or C++. Which language to use is either selected explicitly via a command line switch or implicitly from the file extension of the source file. In that case there is no difference between the C and C++ compiler.

        As the earlier posters indicated, there are definitely differences between the C and C++ languages.

        Which were you asking about?

        Cheers,
        Don

        Comment

        Working...