Feature / Aspect | C Language | C++ Language |
---|---|---|
1. Programming Paradigm | Procedural Programming Language | Multi-paradigm: Procedural + Object-Oriented Programming |
2. Origin | Developed by Dennis Ritchie in 1972 | Developed by Bjarne Stroustrup in 1983 as an extension of C |
3. Language Type | Middle-level language | Middle-level language with high-level features |
4. Object-Oriented Features | Not supported | Fully supports OOP: classes, objects, inheritance, polymorphism |
5. Encapsulation | Not supported | Supported through classes and access specifiers |
6. Data Hiding | Not possible | Possible using access modifiers (private , protected ) |
7. Function Overloading | Not supported | Supported in C++ |
8. Operator Overloading | Not available | Available in C++ |
9. Templates | Not supported | Supported (Generic Programming with templates) |
10. Exception Handling | Manual error handling using if / else | Built-in exception handling using try , catch , throw |
11. Standard Libraries | Fewer standard libraries (e.g., stdio.h , stdlib.h ) | Rich standard libraries including STL (Standard Template Library) |
12. Input / Output | Uses scanf() and printf() | Uses cin and cout (with iostream library) |
13. Memory Management | Uses malloc() and free() | Uses new and delete , also supports malloc() /free() |
14. Namespace Support | Not supported | Supported using namespace keyword |
15. File Extension | .c | .cpp |
16. Code Complexity | More code required for complex tasks | Less code, more abstraction, easier to manage |
17. Application Type | Suitable for system-level programming (OS, embedded) | Suitable for application-level development (games, GUI apps) |
Difference Between C and C++
