what is the main difference between c and c++?

Answer Posted / ravneet dhillon

1.c supports build-in and primitive datatype whereas c++
supports both build-in and user-defined datatype.

2.no namespace are present in c. namespace are present in c++.

3.polymorphism is not possible in c.polymorphism is possible
in c++.

4.no virtual function are present in c.there are virtual
function in c++.

5.In c,we have to declare variables at the start.In c++ we
can declare variables at any point with in a block not just
at the begining.

6.operator overloading is not possible in c.operator
overloading is possible in c++.

7.c have no classes.c++ use classes.

8.multiple declaration of global variables are allowed in
c.multiple declarations of global variables are not allowed
in c++.

9.c supports top down parsing.c++ supports bottom of parsing.

10.in c we can call main() function through other
function.in c++ we can not call main() function through
other function
or
we can say main function could be recursive in c and it
can't be called recursively in c++.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does and I oop mean in text?

625


What is object in oop?

684


Can an interface inherit a class?

565


How do you use inheritance in unity?

595


What is polymorphism and example?

594






#include #include #include #include void insert(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); insert(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void insert(char *items, int count) { register int a, b; char t; for(a=1; a < count; ++a) { t = items[a]; for(b=a-1; (b >= 0) && (t < items[b]); b--) items[b+1] = items[b]; items[b+1] = t; } } design an algorithm for Insertion Sort

2170


What is this pointer in oop?

557


Why do we use polymorphism?

580


How do you explain polymorphism?

596


What is polymorphism explain?

694


Who invented oop?

659


What is class and example?

569


Why it is called runtime polymorphism?

577


What does I oop mean?

618


Can we have inheritance without polymorphism?

617