Difference Between C and C++

 


                                                C vs C++



DIFFERENCES BETWEEN C AND C++

S.N

C

C++

1.

File Name: (.c)

File Name: (.cpp)

2.

Structured or procedural language (Programs are divided into modules and functions) or Function Oriented Language.

Object oriented programming language (Programs are divided into classes and methods).

C++ supports both procedural and object oriented programming

3.

C is subset of C++

C++ is superset of c (Extension of c or c with OOPS)

4.

In c, the constants are defined using macros

In c++, the constants are defined using the keyword const

5.

It follows Top down approach

(Dividing a problem into set of modules)

Solving main module first (top level) and then solve sub module separately and complete the solution)

It follows Bottom up approach

(Solving sub modules first (bottom level)and integrate them as whole and complete the solution)

6.

C is derived from B and BCPL languages

C++ is derived from C and Simula languages. It is a superset of c.

7.

C uses scanf() and printf() for standard input and output operations

C++ uses cin>> and cout<< for standard input and output

8.

In c, we can call main() function through other function

In c++, we can’t call main() function through other function

9.

In c

malloc() / calloc() functions are used for memory allocation

free() function is used for memory deallocation

 

In c++

new operator is used for memory allocation

delete operator is used for memory deallocation

 

10.

It contains 32 reserved keywords

It contains 52 reserved keywords

11.

The default header file is

#include<stdio.h>

The default header file is #include<iostream.h>

12.

C supports GTK framework for developing GUI programming

C++ supports QT framework for developing GUI programming

13.

C language supports only pointers

C++ supports both pointers and references

14.

In c, the data is not secured (unsecured)

In c++, the data is secured using the data hiding concept. The data is not accessible to any external functions. Hence it is more secure.


Recommended IDE

  • Code Blocks

  • VSC Editor


Pictorial Representation


Comments

Popular posts from this blog

Vivo V30 Pro 5G

Xiaomi 14 - Features, Price

Oppo F25 Pro 5G Review - Features, Price