Whether you are preparing for a technical interview or you want to know for general knowledge? If you want to know every single difference between both languages. This article is for you.
After analyzing many technical interviews Shout Coders have come up with the list of difference between c and c++.
|1. History of languages||Dennis Ritchie launched C language in 1972 at AT&T Bell Laboratory.||Bjarne Stroustrup developed this language in 1979.|
|2. Input Function||C language uses the Scanf() function to get the input from the user.||On the other hand, C++use the Cin>> function to get the output.|
|3. Output Function||C language uses the Printf() function to print the output on the screen||In C++ we use cout< function to print the output on the screen.|
|4. Header Files||C languages use the #include<stdio.h> and #include< conio.h> to make all the main function accessible .||But C++ language use the #include<iostream.h> and #include<conio.h>. Iostream is used to get all input and output related functions.|
||C language is a procedural programming language and does not al the concepts of object-oriented programming||C++ is a procedural language and also support all the concepts of object-oriented programming.|
|6. Dynamic Memory Allocation||This language uses malloc() and calloc() to dynamically allocate the memory. And free() function to clear the memory.||In this, we use new to allocate the memory and delete for clearing the memory.|
|7. Function overloading and overriding||Because c does not support OOPS and function overloading and overriding are not possible.||C++ supports both attributes.|
|8. Evolution||The language was first developed and thus it is a subset of c++ programming language.||This contains all the attributes of c language and also has some additional features that’s why it is a superset of c language.|
|9. Concept of Exception Handling||This is the major drawback of c language and does not support exception handling.||C++ supports this feature and solves many problems.|
|10. Keywords||C contains 32 keywords.||C++ has 52 keywords in it.|
After reading this you will be able to give a very informative and crispy answer to your interviewer or your teacher.
Check other language differences that are important from the interview point of view.
- Difference between Java and Python