Main differences between C and C++

Asked By 0 points N/A Posted on -
qa-featured

Hi! I have a Question for Programmers.  I want to know bit detail on both C and C++. What are the main differences between C and C++. Why we prefer C++ instead of C? Does it effect on the coding also? Is it possible to use C and C++ in TURBO C?

SHARE
Best Answer by Ian Richardson
Best Answer
Best Answer
Answered By 0 points N/A #85815

Main differences between C and C++

qa-featured

Good Question 🙂

Data is secured in C++ unlike C. So C++ is a more secure language than C.

C ++ is a middle-level language where as C comes in low-level language

Approach type in programming is different.

C++ uses the bottom-up approach while C uses top-down approach.

 

C is function oriented while C++ is object oriented language.

C++ unlike C supports function overloading  concept.

Function inside structures can be used in C++ unlike C.

Input output functions that are standard differ in both the languages.

 

We prefer C++ instead of C as it is more advanced language than C with lots of features and mainly because it has a feature for data protection known as Encapsulation.

 

Ya it is possible to use C and C++ in Turbo C. Just that C program is to be saved with extension “  “ .C” and C++ program with extension “ .C++”

Answered By 0 points N/A #85816

Main differences between C and C++

qa-featured

<Nice Question:>

The main difference between C and C++ is that In C we can declare only variables in a structure where as in case of C++ we can declare both data variables and member functions. That is why it is much prefer to use C++ than the C language.

And some C programs are not executed in C++.

example:

I have a statement in C like,

int boot;

/* boot is a variable of type int (** boot not identifier in C) */

The same statement,

int boot;

is written in C++, It gives an error "redeclaration of type 'boot';

On the other hand, I can say yes to the last question because Turbo C is an obsolete version of C compiler. Do not confuse of the compiler with a programming language (C++).

 

Related Questions