Difference between C and C++
C++ is often viewed as a superset of C. C++ is also known as a "C with class" This was very nearly true when C++ was originally created, but the two languages have evolved over time with C picking up a number of features that either weren't found in the contemporary version of C++ or still haven't made it into any version of C++. That said, C++ is still mostly a superset of C adding Object-Oriented Programming, Exception Handling, Templating, and a more extensive standard library.

Below is a table of some of the more obvious and general differences between C and C++. There are many more subtle differences between the languages and between versions of the languages.
Aspect | C | C++ |
---|---|---|
Developer | C was developed by Dennis Ritchie between the year 1969 and 1973 at AT&T Bell Labs. | C++ was developed by Bjarne Stroustrup in 1979. |
OOPs Support | C does not support polymorphism, encapsulation, and inheritance which means that C does not support object-oriented programming. | C++ supports polymorphism, encapsulation, and inheritance because it is an object-oriented programming language. |
Subset/Superset | C is (mostly) a subset of C++. | C++ is (mostly) a superset of C. |
Keywords | Number of keywords in C: - C90: 32 - C99: 37 - C11: 44 - C23: 59 | Number of keywords in C++: - C++98: 63 - C++11: 73 - C++17: 73 - C++20: 81 |
Programming Paradigm | For the development of code, C supports procedural programming. | C++ is known as hybrid language because C++ supports both procedural and object-oriented programming paradigms. |
Encapsulation | Data and functions are separated in C because it is a procedural programming language. | Data and functions are encapsulated together in form of an object in C++. |
Data Hiding | C does not support data hiding. | Data is hidden by the Encapsulation to ensure that data structures and operators are used as intended. |
Focus of Language | C is a function driven language because C is a procedural programming language. | C++ is an object driven language because it is an object-oriented programming. |
Overloading | Function and operator overloading is not supported in C. | Function and operator overloading is supported by C++. |
Function Inside Structures | Functions in C are not defined inside structures. | Functions can be used inside a structure in C++. |
Namespaces | Namespace features are not present inside the C. | Namespace is used by C++, which avoid name collisions. |
Standard I/O | Standard IO header is stdio.h and uses scanf() and printf() functions are used for input/output in C. | Standard IO header is iostream.h and uses cin and cout are used for input/output in C++. |
References | Reference variables are not supported by C. | Reference variables are supported by C++. |
Virtual Functions | Virtual and friend functions are not supported by C. | Virtual and friend functions are supported by C++. |
Inheritance | C does not support inheritance. | C++ supports inheritance. |
Dynamic Memory | C provides malloc() and calloc() functions for dynamic memory allocation, and free() for memory de-allocation. | C++ provides new operator for memory allocation and delete operator for memory de-allocation. |
Exception Handling | Direct support for exception handling is not supported by C. | Exception handling is supported by C++. |
Access Modifiers | C structures don't have access modifiers. | C ++ structures have access modifiers. |
Type Checking | There is no strict type checking in C programming language. | Strict type checking in done in C++. So many programs that run well in C compiler will result in many warnings and errors under C++ compiler. |
Type Punning with Unions | Type punning with unions is allows (C99 and later) | Type punning with unions is undefined behavior (except in very specific circumstances) |
Named Initializers | Named initializers may appear out of order | Named initializers must match the data layout of the struct |
Extension | File extension is ".c" | File extension is ".cpp" or ".c++" or ".cc" or ".cxx" |
Generic Programming | Meta-programming using macros and _Generic() | Meta-programming using templates (macros are still supported but discouraged) |