UrbanPro

Learn IT Courses from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What is the difference between C and C++??

Asked by Last Modified  

Follow 0
Answer

Please enter your answer

Computer

Many tend to write "C/C++", as if they were the same thing. Although they share many similarities, they are clearly not the same. But what are really the fundamental differences between C and C++? Is C++ an enhanced version of C, or are there features in C which do not exist in C++? (user-defined)...
read more
Many tend to write "C/C++", as if they were the same thing. Although they share many similarities, they are clearly not the same. But what are really the fundamental differences between C and C++? Is C++ an enhanced version of C, or are there features in C which do not exist in C++? (user-defined) static type system : allow static checks about your data and their usage - points a lot of easily done errors in C. multi-"paradigm" : allow working like in C, with object-oriented paradigms, with generic paradigms etc. Constructor/Destructor : the only way to say once what to do when creating or destroying something and be sure the user will not have to find the right function and use it like in C RAII (badly named) : you don't have to always manage memory. Just keep things in scope and use smart pointers describing your objects lifetime. Still can use raw pointers. Templates : better than macro, a real language to manipulate and generate types before the final compilation. Only lacks a type system (see Concepts in future C++ standards). Operator overloads : allow to describe operations in a simple syntactic manner and even to define embedded domain-specific languages inside your C++ code. Scoped names : namespaces, classes/struct, functions, etc. have simple rules to make sure names don't clash. Exception system : a way to propagate errors that is often better than return code. In fact, return code are good for domain-specific logical errors, because the application have to manage it. Exception are used for "hard" errors, things that make the following code just incorrect. It allows for catching errors higher in the call stack if possible, react to such exception (by logging or by fixing the state) and with RAII, if well used, it don't make the whole program wrong - if done well, again. The Standard Library : C have his own, but it's all "dynamic". The C++ standard library is almost (not IO streams) made of templates (containers and algorithms) that allow generating code only for what you use. Better : as the compiler have to generate code, it will know a lot about the context and will hapily apply a lot of optimizations without having to require the coder to obfuscate it's code - thanks to templates and other things. const-correctness : The best way to make sure you don't change variables you shouldnt. Allow to specify read-only access to varaibles. And is only checked at compile time so there is no runtime cost. C++ was invented to manage complexity that C could not handle. For example, a common problem with C was that you could "run out of names for variables" (not to be taken literally of course) because there was no encapsulation, namespaces etc. Also, C does not have exceptions, therefore error handling is very error prone, since it depends on the library user to always check return values of funcs, whereas with exceptions, the library developer simply throws an exception that guarantees program flow will be halted. C++ helps by having the constructor init objects which is automatically called by compiler. Unlike C structs which need to be initialized by the programmer (hence another error-prone area). Lastly, there is a lot of other advantages touted by OOP , such as object reuse as well the generic programming based concepts, such as templates and generics which allow you to reuse source code,etc. And a lot of other things that would take too much of my time to list here. read less
Comments

Post Graduation in DataScience BigData

Hi Ahmed, check out below for differences                                C 1. C is Procedural Language. 2. No virtual Functions are present in C 3. In C, Polymorphism is not possible. 4. Operator overloading is not possible in C. 5. Top down approach is used in Program Design. 6. No namespace...
read more
Hi Ahmed, check out below for differences                                C 1. C is Procedural Language. 2. No virtual Functions are present in C 3. In C, Polymorphism is not possible. 4. Operator overloading is not possible in C. 5. Top down approach is used in Program Design. 6. No namespace Feature is present in C Language. 7. Multiple Declaration of global variables are allowed. 8. In C scanf() Function used for Input. printf() Function used for output. 9. Mapping between Data and Function is difficult and complicated. 10. In C, we can call main() Function through other Functions 11. C requires all the variables to be defined at the starting of a scope. 12. No inheritance is possible in C. 13. In C, malloc() and calloc() Functions are used for Memory Allocation and free() function for memory Deallocating. 14. It supports built-in and primitive data types. 15. In C, Exception Handling is not present.                               C++ 1. C++ is non Procedural i.e Object oriented Language. 2. The concept of virtual Functions are used in C++. 3. The concept of polymorphism is used in C++. Polymorphism is the most Important Feature of OOPS. 4. Operator overloading is one of the greatest Feature of C++. 5. Bottom up approach adopted in Program Design. 6. Namespace Feature is present in C++ for avoiding Name collision. 7. Multiple Declaration of global varioables are not allowed. 8. In C++ Cin>> Function used for Input. Cout<< Function used for output. 9. Mapping between Data and Function can be used using "Objects" 10. In C++, we cannot call main() Function through other functions. 11. C++ allows the declaration of variable anywhere in the scope i.e at time of its First use. 12. Inheritance is possible in C++ 13.In C++,  new and delete operators are used for Memory Allocating and Deallocating. 14. It support both built-in and user define data types. 15. In C++, Exception Handling is done with Try and Catch block. read less
Comments

16 Yrs of Experience in Teaching

C follows concepts of Procedure oriented and C++ follows concepts of Object oriented , for student point of view C++ is more concept base and 80% of program starts with Class and object
Comments

Professional PHP/WordPress/CI/HTML/CSS Trainer

C++, as the name suggests, is a superset of C. As a matter of fact, C++ can run most of C code while C cannot run C++ code. Here are the 10 major differences between C++ & C… 1. C follows the procedural programming paradigm while C++ is a multi-paradigm language(procedural as well as object oriented) In...
read more
C++, as the name suggests, is a superset of C. As a matter of fact, C++ can run most of C code while C cannot run C++ code. Here are the 10 major differences between C++ & C… 1. C follows the procedural programming paradigm while C++ is a multi-paradigm language(procedural as well as object oriented) In case of C, importance is given to the steps or procedure of the program while C++ focuses on the data rather than the process. Also, it is easier to implement/edit the code in case of C++ for the same reason. 2. In case of C, the data is not secured while the data is secured(hidden) in C++ This difference is due to specific OOP features like Data Hiding which are not present in C. 3. C is a low-level language while C++ is a middle-level language (Relatively, Please see the discussion at the end of the post) C is regarded as a low-level language(difficult interpretation & less user friendly) while C++ has features of both low-level(concentration on whats going on in the machine hardware) & high-level languages(concentration on the program itself) & hence is regarded as a middle-level language. Note: This is a relative difference. See updates at end of this post. 4. C uses the top-down approach while C++ uses the bottom-up approach In case of C, the program is formulated step by step, each step is processed into detail while in C++, the base elements are first formulated which then are linked together to give rise to larger systems. 5. C is function-driven while C++ is object-driven Functions are the building blocks of a C program while objects are building blocks of a C++ program. 6. C++ supports function overloading while C does not Overloading means two functions having the same name in the same program. This can be done only in C++ with the help of Polymorphism(an OOP feature) 7. We can use functions inside structures in C++ but not in C. In case of C++, functions can be used inside a structure while structures cannot contain functions in C. 8. The NAMESPACE feature in C++ is absent in case of C C++ uses NAMESPACE which avoid name collisions. For instance, two students enrolled in the same university cannot have the same roll number while two students in different universities might have the same roll number. The universities are two different namespace & hence contain the same roll number(identifier) but the same university(one namespace) cannot have two students with the same roll number(identifier) 9. The standard input & output functions differ in the two languages C uses scanf & printf while C++ uses cin>> & cout<< as their respective input & output functions 10. C++ allows the use of reference variables while C does not Reference variables allow two variable names to point to the same memory location. We cannot use these variables in C programming. MORE - 11. C++ supports Exception Handling while C does not. C does not support it “formally” but it can always be implemented by other methods. Though you don’t have the framework to throw & catch exceptions as in C++. read less
Comments

Tableau and Power BI Trainer along with SQL Server

Hello Ahmad, C is a procedural oriented language and C++ is an object oriented programming language( OOP ) which supports data encapsulation, abstraction, inheritance, polymorphism where c does not supports all this. In C, Polymorphism is not possible.The concept of polymorphism is used in C++. Polymorphism...
read more
Hello Ahmad, C is a procedural oriented language and C++ is an object oriented programming language( OOP ) which supports data encapsulation, abstraction, inheritance, polymorphism where c does not supports all this. In C, Polymorphism is not possible.The concept of polymorphism is used in C++. Polymorphism is the most Important Feature of OOPS.Operator overloading is not possible in C. Operator overloading is one of the greatest Feature of C++. read less
Comments

Coming to the actual point,the differences I can point are. C is procedural language and C++ is Object Oriented language.Means C has basic building blocks of functions and procedure while C++ has basic building blocks of Objects.Every thing can be called from or within an object.
Comments

Computer Science Tutor

C is a procedural oriented language and C++ is an object oriented programming language( OOP ) which supports data encapsulation, abstraction, inheritance, polymorphism where c does not supports all this.
Comments

Tutor

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...
read more
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++ foravoiding 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 MemoryAllocation 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. read less
Comments

Software trainer

c is procedure oriented and c++ is object oriented programming
Comments

Tutor

C is the basic initial language of software and C++ is the advance language then C
Comments

View 13 more Answers

Related Questions

Is c language easy to learn?
The ease of learning C language depends on your prior programming experience and familiarity with certain concepts. For beginners, C can be challenging due to its syntax and manual memory management. However,...
Vikash
0 0
6
Is there any online Python coaching classes available?
Yes it is. You can contact me and visit my profile for Online classes
Abhishek
0 0
5
My name is Pratik Jagtap. I wanna be the best hacker. From where should I start...?
You should be well versed in any of the coding/programming languages to begin with.
Pratik
0 0
5

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

10 Best Job Interview Tips for Jobseekers
10 Best Job Interview Tips for Jobseekers:- 1. Conduct Research on the Employer, Hiring Manager, and Job Opportunity2. Review Common Interview Questions and Prepare Your Responses3. Dress for Success4....

How to Introduce yourself to the Interviewer?
1. According to me there are 10-step process. Step1: category 1 Who are you? Greetings : Good morning before 12noon, good afternoon after 12 noon. Don't look at your watch while greetings with smile...

Regularisation in Machine Learning
Regularization In Machine Learning, Regularization is the concept of shrinking or regularizing the coefficients towards zero. It helps the model to prevent overfitting. Overfitting in Machine Learning...

What is a SQL join?
A SQL join is a Structured Query Language (SQL) instruction to combine data from two sets of data (e.g. two tables). Before we dive into the details of a SQL join, let’s briefly discuss what SQL...

Project Management Business Documents
Project Business Case It documents the economic feasibility of the project. It is prepared before starting the project and can result in a go/no-go decision for the project. One of the criteria for determining...

Recommended Articles

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Business Process outsourcing (BPO) services can be considered as a kind of outsourcing which involves subletting of specific functions associated with any business to a third party service provider. BPO is usually administered as a cost-saving procedure for functions which an organization needs but does not rely upon to...

Read full article >

Microsoft Excel is an electronic spreadsheet tool which is commonly used for financial and statistical data processing. It has been developed by Microsoft and forms a major component of the widely used Microsoft Office. From individual users to the top IT companies, Excel is used worldwide. Excel is one of the most important...

Read full article >

Whether it was the Internet Era of 90s or the Big Data Era of today, Information Technology (IT) has given birth to several lucrative career options for many. Though there will not be a “significant" increase in demand for IT professionals in 2014 as compared to 2013, a “steady” demand for IT professionals is rest assured...

Read full article >

Looking for IT Courses ?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for IT Courses Classes?

The best tutors for IT Courses Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn IT Courses with the Best Tutors

The best Tutors for IT Courses Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more