Difference Between C and C++

 

Difference Between C And C++ :-

  • C++ was developed as an extension of C, and both languages have almost the same syntax.
  • The main difference between C and C++ is that C++ support classes and objects, while C does not.

Similarities between C and C++ are :- 


Data Types :- Both languages use similar primitive data types like int, char, float, double, and void.

Basic Syntax :- Both languages share similar basic syntax, including the use of semicolons to end statements, curly braces {} to define blocks of code.

Operators :-

  • Arithmetic operators (+, -, *, /, %)
  • Relational operators (==, !=, <, >, <=, >=)
  • Logical operators (&&, ||, !)
  • Bitwise operators (&, |, ^, ~, <<, >>)
  • Assignment operators (=, +=, -=, *=, /=, %=, <<=, >>=, &=, ^=, |=)
  • Increment and decrement operators (++, --)
  • Conditional operator (?:)

Pointers :- Both languages support pointers, allowing direct memory access and manipulation. And Similar syntax for defining and using pointers.


SR.NO

Parameter

C

C++

1

Stand For

Procedural Programming Language

Object Oriented Language

2

Approach

Top – Down Approach

Bottom – Up Approach

3

Inheritance

C does not support inheritance

C++ support inheritance

4

Developed By

Dennis Ritchie at the Bell Laboratories in 1972.

Bjarne Stroustrup in 1979

5

Input / Output

printf() and scanf()

cout<< and cin>>

6

File Extension

Save as “.c”

Save as “.cpp”, “.c++”

7

Keyword

There are 32 keywords in the C.

There are 97 keywords in the C++.

8

Support Overloading

C does not support overloading.

C++ does support overloading.

9

Access Specifier

C does not have access specifier.

C++ does have access specifier.

10

Header File

C is standard IO header file <stdio.h> used it.

C++ is standard IO header file <iostram.h> used it.

11

Data Types

Built-in data types is used in it.

Built-in and user-defined data types used in it.

12

Example

C, Python, Etc.

C++, Java, C#, Versa, Etc.










Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.