Sie sind auf Seite 1von 4

Difference Between C and C++

What is C programming language?


C is middle-level programming language which was developed at Bell Lab in 1972 by
Dennis Ritchie. C language combines the features of Low level as well as High-level
Language. Hence its considered a middle-level Language.

C is a high-level classical type programming language that allows you to develop


firmware and portable applications. The C language was developed with an objective
of writing system software. It is an ideal language for developing firmware systems.

What is C++ programming language?


C++ is a computer programming language that contains the feature of C programming
language as well as Simula67( a first object Oriented language). C++ introduced the
concept of Class and Objects.

It encapsulates high and low-level language features. So, it is seen as an intermediate


level language. Earlier it was called "C with classes" as it had all the properties of the
C language.

C Vs. C++: Key Differences

Basis of
C C++
distinction
Programming It is an Object-Oriented
It is a Procedural Oriented language.
type Programming language.
C language follows Top Down C++ follow bottom-up
Approach
programming approach programming approach.
The file extension of a c+ +
File extension The file extension of a C program is .c
program language is.cpp
Basis of
C C++
distinction
In C programming language, a big program In C++ programming language, a
Program division code is divided into small pieces which is big program code is divided into
called functions. Objects and Classes.
Structure in C++ provides the
Structure in C not provide the feature of feature of declaring a function as
Structure
function declaration. a member function of the
structure.
Inline function It does not allow inline function. It supports inline function.
In C++ cin» and cout« are given
Standard I/O In C scan and printf are used for the
for standard input and output
operations standard input and output
operations.
Data is secure, so it can't be
accessed by external functions.
Data Security In C language the data is not secured.
(Using Encapsulation concept of
OOPs)
C is an older programming language that is
described as Hands-on. In this language, C++ is an extension language of
Ease of Coding you must tell the program to do everything. C. It allows for the highly
Moreover, this language will let you do controlled object-oriented code.
almost anything.
Compatibility
C++ is compatible with the other
with other C is not compatible with another language.
generic programming languages.
languages
C++ supports both pointers and
Pointer C supports only Pointers.
references.
C++ allows you to declare
In C, the variable should be defined at the
Variable variables anywhere in the
beginning of the program.
function.
C++ emphasizes the objects and
C focuses on the steps or procedures that
Point of Focus not the steps or procedures. It has
are followed to solve a problem.
higher abstraction level.
Function C does not allow you to use function C++ allows you to use function
Overloading overloading. overloading.
C language does not allows you to declare
C++ supports String and Boolean
Data Types String or Boolean data types. It supports
data types.
built-in and primitive data types.
C++ supports Exception
C does not support Exception Handling.
Exception handling. Moreover, this
However, it can be performed using some
Handling operation can be performed using
workarounds.
try and catch block.
Does not allows functions with default Allow functions with default
Functions
arrangements arrangements.
Basis of
C C++
distinction
Namespace It is absent in C language. It is present in the C++ language.
Originally developed from the C
Source Code Free-format program source code.
programming language.
C++ is a superset of C. C++ can
C is a subset of C++. It cannot run C++
Relationship run most of C code while C
code.
cannot run C++ code.
Driven by Function-driven language Object-driven language
Focuses on method or process instead of Focuses on data instead of
Focus
data. method or procedure.
Supports encapsulation. Data and
Does not support encapsulation. As Data
Encapsulation functions are encapsulated
and functions are separate and free entities.
together as an object.
C does not support information hiding. In Encapsulation hides the data. So
Information
this language, data are free entities and can that data structures and operators
hiding
be changed outside code. are used as per intention.
Memory C provide malloc() and calloc() functions C++ provides a new operator for
management for dynamic memory allocation. this purpose.
Supports built-in & user-defined
Data Types Supports built-in data types.
data types.
Allows Multiple Declaration of global Multiple Declaration of global
Global Variables
variables. variables are not allowed.
The mapping between Data and
Concept of The mapping between Data and Function is Function can be easily
Mapping very complicated. established using "Classes and
Objects."
Inheritance is possible in C++
Inheritance Inheritance is not supported C
language.
Default header C++ uses iosteam.h as default
C used stdio.h header file.
file header file.
The concept of virtual Functions are present The concept of virtual Function
Virtual function
in C. is not used in C++.
Keywords Contain 32 keywords. Contains 52 keywords.
The concept of polymorphism is
used in C++. Polymorphism is
Polymorphism In C. Polymorphism is not possible
one of the most Important
Features of OOPS.
GUI C language offers GTK tool for GUI C++ supports Qt tools for
programming programming GUIprogramming

Conclusion:
 C is middle-level programming language which was developed at Bell Lab in
1972 by Dennis Ritchie
 C++ computer programming language was developed by Bjarne Stroustrup in
1980
 C is a high-level classical type programming language that allows you to
develop firmware and portable applications
 C++ introduced the concept of Class and Object; It encapsulates high and low-
level language features
 C is a Procedural Oriented language
 C++ is an Object-Oriented Programming language
 C supports only Pointers, on the other hand, C++ supports both pointers and
references
 In C language, Polymorphism is not possible while it is possible in C++

Das könnte Ihnen auch gefallen