Difference Between C and C++

C and C++ are computer programming languages that are used to design various application softwares and system softwares. Complete Unix operating system is written in C language.
C++ is an extension of C language that contains all best features of C and some additional features also. The main objective of this article is to teach you about basic difference and similarities between two computer languages.

Introduction to C Language

C is a procedure oriented language that was developed by Dennis Ricthie in 1972 at AT & T’s Bell laboratory. This is a middle level language that provides faster program development and faster program execution. This is a more reliable, simple and user friendly language.
C is a basic programming language that is necessary to design the foundation of any computer programmer.

Introduction to C++ Language

C++ is an Object Oriented Language that was developed by Bjarne Stroustrup in 1980 at AT & T’s Bell laboratory. Initially the language was famous as “C with Classes” name. In 1983, the name was changed to C++. The idea was generated from C increment operator (++).  So C++ is also famous as increment version of C language.
In 1990 significant modifications were made in C++ language to make it more popular among users. Inheritance and polymorphism are the advance features that make this language more popular. It also reduced the code length
Similarity
• Syntax: C and C++ use same data types, flow controls and operators.
• Compiler: Both languages use the same compiler to compile the program code.
Dissimilarity
• Input / Output Function: C uses scanf function for input and printf function for output. On the other hand, C++ uses cin for input and cout for output.
• Classes: The major difference between two languages is classes. C++ introduced the new concept of classes. The other unique features of C++ are polymorphism, inheritance and encapsulation. C language uses structure instead of classes.
• Speed: C application has faster compile and execution time as compared to C++application.
• Object Oriented: C++ is an object oriented language that employs bottom up approach. In C++, large programs are divided into small objects. On the other side, C is a procedure oriented language that follows bottom up approach. In c language, large programs are divided into small functions.
• Pointer: Pointer was a complicated concept used in C language. This concept was eliminated in C++ language.
• Easy to use: C++ is simpler as concept of pointer is no more available in C++ language.
• Memory Allocation: Both languages used different memory allocation methods.
• Header file: C++ used #include<iostream.h> header file for Input and output functions. On the other hand, for C language input and output functions are declared in #include<stdio.h> header file.

Conclusion
The above discussion concludes that C and C++ are both strong and popular computer programming languages. You can use any of them according to your requirement. For faster execution programs, C language is being optimum choice for you. For simple program code, C++ is an excellent choice.

References
 http://www.comp.lancs.ac.uk/~marash/SlidesCpp/slides/tsld051.htm
http://www.diffen.com/difference/C_vs_C%2B%2B
http://www.faqs.org/qa/qa-117.html

No comments:

Post a Comment