Skip to content

Differences between C and C++

There are several differences regarding C and C++ programming languages. The most common is that c++ is an advanced C. C is a procedural programming language and does not support classes and objects where c++ is the combination of procedural and object oriented programming language.

Following are some differences

No
Basis Of DistinctionCC++
1Nature Of LanguageC is a structural or procedural type of programming language.C++ is an object-oriented programming language and supports Polymorphism, Abstract Data Types, Encapsulation, among others.
2Point Of EmphasisC lays emphasis on the steps or procedures that are followed to solve a problem.C++ emphasizes the objects and not the steps or procedures. It has higher abstraction level.
3Compatibility With OverloadingC does not support function overloading.C++ supports function overloading, implying that one can have name of functions with varying parameters.
4Data TypesC does not provide String or Boolean data types. It supports primitive & built-in data types.C++ provides Boolean or String data types. It supports both user-defined and built-in data types.
5Compatibility With Exception HandlingC does not support Exception Handling directly. It can be done through some other functions.C++ supports Exception Exception:Handling can be done through try & catch block.
6Compatibility With FunctionsC does not support functions with default arrangementsC++ supports functions with default arrangements.
7Compatibility With Generic ProgrammingC is not compatibleC++ is compatible with generic programming
8Pointers And ReferencesC supports only PointersC++ supports both pointers and references.
9Inline FunctionC does not have inline function.C++ has inline function.
10Data SecurityIn C programming language, the data is unsecured.Data is hidden in C++ and is not accessible to external functions. Hence, is more secure
11ApproachC follows the top-down approach.C++ follows the bottom-up approach.
12Functions For Standard Input And Outputscanf and printfcin and cout
13Time Of Defining VariablesIn C, variable has to be defined at the beginning, in the function.Variable can be defined anywhere in the function.
14NamespaceAbsentPresent
15Division Of ProgramsThe programs in C language are divided into modules and functions.The programs are divided into classes and functions in the C++ programming language.
16File Extension*.C*.CPP
17Function And Operator OverloadingAbsentPresent
18MappingMapping between function and data is complicated in C.Mapping between function and data can be done easily using ‘Objects’.
19Calling Of Functionsmain() function can be called through other functions.main() function cannot be called through other functions.
20InheritancePossibleNot possible
21Functions Used For Memory Allocation And Deallocationmalloc() and calloc for Memory Allocation and free() function for Deallocation.New and delete operators are used for Memory Allocation and Deallocation in C++.
22InfluencesC++, C#, Objective-C, PHP, Perl, BitC, Concurrent C, Java, JavaScript, Perl, csh, awk, D, LimboC#, PHP, Java, D, Aikido, Ada 95
23Influenced ByB (BCPL,CPL), Assembly, ALGOL 68,C, ALGOL 68, Simula, Ada 83, ML, CLU
24Level of LanguageMid-levelHigh-level
25ClassesC uses structures thereby, giving freedom to use internal design elementsclass and structures