What is the difference between C and C++?

C++ has been developed from C. However, as it was intended to be an improvement on C, it features various differences when compared to its predecessor.

C Programming Language

C++ Programming Language

Supports procedural style programming

Supports both procedural style and object oriented programming

Follows top down approach

Follows bottom up approach

Is a middle level language.

Is a high level language

Functions are the fundamental building blocks

Objects are the fundamental building blocks

Does not support function overloading

Supports function overloading

Does not support operator overloading

Supports operator overloading

Can’t use functions in structure

Can use functions in structure.

Uses scanf() and printf() for input/output functions

Uses cin and cout for input/output functions

Data is less secure

Can use modifiers to make class members inaccessible for outside users

Variables must be defined at the beginning in the function

Variables can be defined anywhere in the function.

Does not support namespace feature

Supports namespace feature

Programs are divided into modules and functions.

Programs are divided into classes and functions.

Does not support exception handling directly

Supports exception handling via try and catch block

The main() function can be called from other functions

The main() function cannot be called from other functions as the program execution starts from the main() function.

Does not support inheritance

Supports inheritance

Does not support polymorphism

Supports polymorphism

Mapping between data and functions is difficult

Mapping between data and functions is easy

Supports only built-in data types

Supports both built-in and user-defined data types

Uses .C file extension

Uses .CPP file extension

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.