Monday, August 20, 2018

c vs c++

c vs c++


Before concluding this chapter, a few words about C++ are in order. Newcomers are sometimes confused about what C++ is and how it differs from C. In short, C++ is an object-oriented programming language that was built upon the foundation of C. In general terms, C is a subset of C++, or conversely, C++ is a superset of C.
In general, you can use a C++ compiler to compile a C program. In fact, today most compilers handle both C and C++ programs. Thus, most programmers will use a C++ compiler to compile their C code! However, since C++ was built upon the 1989 C standard, you must restrict your C code to the features defined by that standard (which are the features described in Part One of this book).
There is one thing that you must be careful about when using a C++ compiler to compile a C program: the file extension. By convention, C programs use the .C extension. C++ programs use .CPP. Don't accidentally give your C program a .CPP extension. Differences between the two languages might prevent a valid C program from being compiled as if it were a C++ program. By specifying the .C extension, you are telling the C++ compiler to perform a ''C compile."

NOTE:- 
For a complete description of the C++ language, see C++: The Complete Reference, by Herbert Schildt (Berkeley, CA: Osborne/McGraw-Hill).

  • 0Blogger Comment
  • Facebook Comment

Post a Comment