Difference b/w C and C++

                    Difference B/w C  and C++
History of C Language
The C programming language was designed by Dennis Ritchie in the early 1970s at Bell Laboratories. It was first used system implementation language for the nascent Unix operating system. The main reason to devised C was to overcome the limitations of B.  It was Derived from the type-less language BCPL . C was  the evolution of B and BCPL by incorporating type checking. It was originally intended for use in writing compilers for other languages.
History of C++
C++ was devised by Bjarne Stroustrup in 1983 at Bell Laboratories. It is an extension of C by adding some enhancements to C language. Bjarne combined the simula's (a language designed for making simulations, created by Ole-Johan Dahl and Kristen Nygaard) features of object oriented and the efficiency of C. The new features added to language are templates, namespaces, exception handling and use of standard library.

Difference
                     C 
                 C++
1.        C  is not a object oriented language. . C follows the procedural programming paradigm .

C++ is object oriented Language. It is partially Object oriented.
2.       C input/output is based on library and the processes are carried out by including functions. 
C++ i/o is made through console commands cin>> and cout<<.
3.       C functions do not support overloading

C++ function support overloading.
4.       C not allows the use of reference variables.

C++ allows the use of reference variables
5.       C not provide security to data.

C++ provide security to data.
6.       C uses the top-down approach.

C++ uses the bottom-up approach.
7.       C is function-driven.

C++ is object-driven.
8.       We can not use functions inside structures
in C.
We can use functions inside structures in C++ 
9.       The NAMESPACE is not a feature of C.

The NAMESPACE feature in C++. 
10.   C program files saved with .c extension.

C++ programs saved with .CPP extension.
11.   C is not a secure language.

C++ is a secure language.
12.   Header file “#include<stdio.h>” used for input/output.
Header file “#include<iostream.h>” used for input/output.
  1. C does not support new or delete commands. The memory operations to free or allocate memory in c are carried out by malloc() and free().

C++ support new or delete commands.

  1. C does not support inheritance , encapsulation , Abstraction and operator overloading.
C++ support inheritance , encapsulation , Abstraction and operator overloading features.
  1. C does not support scope resolution operator  ( :: ).
C++ support scope resolution operator.



 


No comments:

Post a Comment