Differences among C, C++ and Java Programming Languages : C vs C++ vs Java
Aspects | C | C++ | Java |
---|---|---|---|
Developed Year | 1972 | 1979 | 1991 |
Developed By | Dennis Ritchie | Bjarne Stroustrup | James Gosling |
Successor of | BCPL | C | C(Syntax) & C++ (Structure) |
Paradigms | Procedural | Object Oriented | Object Oriented |
Platform Dependency | Dependent | Dependent | Independent |
Keywords | 32 | 63 | 50 defined (goto, const unusable) |
Datatypes : union, structure | Supported | Supported | Not Supported |
Pre-processor directives | Supported (#include, #define) | Supported (#include, #define) | Not Supported |
Header files | Supported | Supported | Use Packages (import) |
Inheritance | No Inheritance | Supported | Multiple Inheritance not Supported |
Overloading | No Overloading | Supported | Operator Overloading not Supported |
Pointers | Supported | Supported | No Pointers |
Code Translation | Compiled | Compiled | Interpreted |
Storage Allocation | Uses malloc, calloc | Uses new , delete | uses garbage collector |
Multi-threading and Interfaces | Not Supported | Not Supported | Supported |
Exception Handling | No Exception handling | Supported | Supported |
Templates | Not Supported | Supported | Not Supported |
Storage class: auto, extern | Supported | Supported | Not Supported |
Destructors | No Constructor or Destructor | Supported | Not Supported |
Database Connectivity | Not Supported | Not Supported | Supported |
15 Most Important Differences Between C And C++
Basic Introduction:
- C++ is derived from C Language. It is a Superset of C.
- Earlier C++ was known as C with classes.
- In C++, the major change was the addition of classes and a mechanism for inheriting class objects into other classes.
- Most C Programs can be compiled in C++ compiler.
- C++ expressions are the same as C expressions.
- All C operators are valid in C++.
Following are the differences Between C and C++ :
C C++ 1. C is Procedural Language. 1. C++ is non Procedural i.e Object oriented Language. 2. No virtual Functions are present in C 2. The concept of virtual Functions are used in C++. 3. In C, Polymorphism is not possible. 3. The concept of polymorphism is used in C++.
Polymorphism is the most Important Feature of OOPS.4. Operator overloading is not possible in C. 4. Operator overloading is one of the greatest Feature of C++. 5. Top down approach is used in Program Design. 5. Bottom up approach adopted in Program Design. 6. No namespace Feature is present in C Language. 6. Namespace Feature is present in C++ for avoiding Name collision. 7. Multiple Declaration of global variables are allowed. 7. Multiple Declaration of global varioables are not allowed. 8. In C
- scanf() Function used for Input.
- printf() Function used for output.
8. In C++
- Cin>> Function used for Input.
- Cout<< Function used for output.
9. Mapping between Data and Function is difficult and complicated. 9. Mapping between Data and Function can be used using "Objects" 10. In C, we can call main() Function through other Functions 10. In C++, we cannot call main() Function through other functions. 11. C requires all the variables to be defined at the starting of a scope. 11. C++ allows the declaration of variable anywhere in the scope i.e at time of its First use. 12. No inheritance is possible in C. 12. Inheritance is possible in C++ 13. In C, malloc() and calloc() Functions are used for Memory Allocation and free() function for memory Deallocating. 13.In C++, new and delete operators are used for Memory Allocating and Deallocating. 14. It supports built-in and primitive data types. 14. It support both built-in and user define data types. 15. In C, Exception Handling is not present. 15. In C++, Exception Handling is done with Try and Catch block. Difference between Java and C++ language:
Difference between Java and C++ language:• According to some experts, Java is pure object oriented programming language while C++ is object based programming language.• The code written in Java can run on different platforms whereas this not possible with C++.• Java is mainly used for developed applets and e-commerce based applications while C++ is used for developing system software.