Difference Between C and C++

Main Difference

The main difference between both programming language is that C is a simple procedural language and simply follows the procedural programming prototype while C++ is a multi-prototype language that means it is both procedural and object oriented.

Comparison Chart

Basis of DistinctionCC++
Nature 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. Even though C++ derives basic syntax from C, it cannot be classified as a structural or a procedural language.
Point 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.
Compatibility With OverloadingC does not support function overloading.C++ supports function overloading, implying that one can have name of functions with varying parameters.
Data 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.
Compatibility With Exception HandlingC does not support Exception Handling directly. It can be donethrough some other functions.C++ supports Exception Exception:Handling can be donethrough try & catch block.
Compatibility With FunctionsC does not support functions with default arrangementsC++ supports functions with default arrangements.
Compatibility With Generic ProgrammingC is not compatibleC++ is compatible with generic programming
Pointers And ReferencesC supports only PointersC++ supports both pointers and references.
Inline FunctionC does not have inline function.C++ has inline function.
Data SecurityIn C programming language, the data is unsecured.Data is hidden in C++ and is not accessible to external functions. Hence, is more secure
ApproachC follows the top-down approach.C++ follows the bottom-up approach.
Functions For Standard Input And Outputscanf and printfcin and cout
Time Of Defining VariablesIn C, variable has to be defined at the beginning, in the function.Variable can be defined anywhere in the function.
NamespaceAbsentPresent
Division 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.
File Extension.C.CPP
Function And Operator OverloadingAbsentPresent
MappingMapping between function and data is complicated in C.Mapping between function and data can be done easily using ‘Objects’.
Calling Of Functionsmain() function can be called through other functions.main() function cannot be called through other functions.
InheritancePossibleNot possible
Functions 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++.
InfluencesC++, C#, Objective-C, PHP, Perl, BitC, Concurrent C, Java, JavaScript, Perl, csh, awk, D, LimboC#, PHP, Java, D, Aikido, Ada 95
Influenced ByB (BCPL,CPL), Assembly, ALGOL 68,C, ALGOL 68, Simula, Ada 83, ML, CLU
Level of LanguageMid-levelHigh-level
ClassesC uses structures thereby, giving freedom to use internal design elementsclass and structures

C

C is an old system programming language developed by Dennis Ritchie in 1969. C has been accepted as an easy, flexible and powerful language used for programming of many applications, either it is for engineering programs or business programs. It was the upgraded version of B language of that time. UNIX operating system was the first operating system written in C and latest operating system like Windows and Linux, are also written in C language. Many computer architectures and operating systems are using this language. The advantages of C language are that it is a most reliable, portable, flexible, efficient, effective and interactive programming language. It is widely used in developing database systems, word processors, spreadsheets and operating system developments. At present 19% of the programs are developed in C programming language.

C++

C++ (Cee Plus Plus) is a multi-prototype, procedural, object-oriented, generic, and functional programming language that also provides the facilities for low-level memory manipulation. It was designed by Bjarne Stroustrup and was initially released in 1983. Latest version of C++ was released on December 15, 2014. C++ is an accumulated language that is used in many platforms and many organizations like FSF, LLVM, Microsoft, and Intel are using this language. It is considered as the recommended programming language to strengthen the software infrastructures and resource-constrained application such as desktop applications, servers (includes e-commerce, web search and SQL servers), performance critical applications (includes telephone switches or space probes), and entertainment software.

Key Differences

  1. C is a simple procedural language and simply follows the procedural programming prototype while C++ is a multi-prototype language that means it is both procedural and object oriented.
  2. C is a case sensitive program language, care is needed in case of programming in C language. While C++ is not a case sensitive language.
  3. C mainly focuses on formal procedures or steps to solve any issue while C++ mainly focuses on objects instead of procedures or steps.
  4. Data security is compromised in C, that’s why not recommended for data security. In C++, data is hidden and can’t be accessed by external workings.
  5. C uses the top down approach while C++ uses the bottom up approach.
  6. scanf() and printf() function are use in C for standard input and output while cin>> and count<< are use for standard input and output function in case of C++.
  7. C is considered as a middle language while C++ is regarded as a high level language.
  8. Over loading and operator overloading supports function is available in C++ while all these are lacking in C.

Comparison Video

YouTube video
Harlon Moss

Harlon currently works as a quality moderator and content writer for Difference Wiki. He graduated from the University of California in 2010 with a degree in Computer Science. Follow him on Twitter @HarlonMoss

View all posts by Harlon Moss