what is the main difference between c and c++?
Answer Posted / rutuja
C does not have any classes or objects. It is procedure and function driven. There is no concept of access through objects and structures are the only place where there is a access through a compacted variable. c++ is object oriented.
C structures have a different behaviour compared to c++ structures. Structures in c do not accept functions as their parts.
C input/output is based on library and the processes are carried out by including functions. C++ i/o is made through console commands cin and cout.
C functions do not support overloading. Operator overloading is a process in which the same function has two or more different behaviours based on the data input by the user.
C does not support new or delete commands. The memory operations to free or allocate memory in c are carried out by malloc() and free().
Undeclared functions in c++ are not allowed. The function has to have a prototype defined before the main() before use in c++ although in c the functions can be declared at the point of use.
After declaring structures and enumerators in c we cannot declare the variable for the structure right after the end of the structure as in c++.
For an int main() in c++ we may not write a return statement but the return is mandatory in c if we are using int main().
In C++ identifiers are not allowed to contain two or more consecutive underscores in any position. C identifiers cannot start with two or more consecutive underscores, but may contain them in other positions.
C has a top down approach whereas c++ has a bottom up approach.
In c a character constant is automatically elevated to an integer whereas in c++ this is not the case.
In c declaring the global variable several times is allowed but this is not allowed in c++.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How oops is better than procedural?
Why is destructor used?
How to use CMutex, CSemaphore in VC++ MFC
write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.
can inline function declare in private part of class?
How to call a non virtual function in the derived class by using base class pointer
Can static class have constructor?
What is oops concept with example?
What do you mean by Encapsulation?
write a program that takes input in digits and display the result in words from 1 to 1000
Can main method override?
What are the 3 pillars of oop?
What is polymorphism explain its types?
What is meant by multiple inheritance?
What does no cap mean?