You are on page 1of 3

C C++

C was developed by Dennis Ritchie


C++ was developed by Bjarne
between the year 1969 and 1973 at
Stroustrup in 1979.
AT&T Bell Labs.

C++
C does no support polymorphism,
supports polymorphism, encapsulatio
encapsulation, and inheritance which
n, and inheritance because it is an
means that C does not support
object oriented programming
object oriented programming.
language.

C is (mostly) a subset of C++. C++ is (mostly) a superset of C.

Number of keywords in C: Number of keywords in C++:


* C90: 32 * C++98: 63
* C99: 37 * C++11: 73
* C11: 44 * C++17: 73
* C23: 59 * C++20: 81

C++ is known as hybrid language


For the development of code, C because C++ supports
supports procedural programming. both procedural and object oriented
programming paradigms.

Data and functions are separated in


Data and functions are encapsulated
C because it is a procedural
together in form of an object in C++.
programming language.

Data is hidden by the Encapsulation


C does not support information
to ensure that data structures and
hiding.
operators are used as intended.

Built-in & user-defined data types is


Built-in data types is supported in C.
supported in C++.

C is a function driven language C++ is an object driven language


because C is a procedural because it is an object oriented
programming language. programming.

Function and operator overloading is Function and operator overloading is


not supported in C. supported by C++.
C C++

C is a function-driven language. C++ is an object-driven language

Functions in C are not defined inside Functions can be used inside a


structures. structure in C++.

Namespace features are not present Namespace is used by C++, which


inside the C. avoid name collisions.

Standard IO header is stdio.h. Standard IO header is iostream.h.

Reference variables are not Reference variables are supported


supported by C. by C++.

Virtual and friend functions are not Virtual and friend functions are
supported by C. supported by C++.

C does not support inheritance. C++ supports inheritance.

Instead of focusing on data, C C++ focuses on data instead of


focuses on method or process. focusing on method or procedure.

C
C++ provides new operator for
provides malloc() and calloc() functio
memory allocation and delete
ns for dynamic memory allocation,
operator for memory de-allocation.
and free() for memory de-allocation.

Direct support for exception handling Exception handling is supported by


is not supported by C. C++.

scanf() and printf() functions are cin and cout are used for input/output
used for input/output in C. in C++.

C structures don’t have access C ++ structures have access


modifiers. modifiers.

C follows the top-down approach C++ follows the Bottom-up approach


C C++

Strict type checking in done in


C++. So many programs that run
There is no strict type checking in C
well in C compiler will result in many
programming language.
warnings and errors under C++
compiler.

C does not support overloading C++ does support overloading

Type punning with unions is


Type punning with unions is allows
undefined behavior (except in very
(C99 and later)
specific circumstances)

Named initializers may appear out of Named initializers must match the
order data layout of the struct

You might also like