what is the main difference between c and c++?
Answers were Sorted based on User's Feedback
Answer / p govind rao
1) C is a structural Language, but C++ is a object oriented
language.
2)C employs top down approach, but c++ employees bottom up
approach.
3) c doesn't support operator overloading but c++ support
operator overloading.
4) In C memory allocation is done with malloc statement
whereas in C++ it is done through new keyword.
5) Also memory is deal located in C using free statement
while in C++ deal location takes place through delete.
6) c is does not provide default argument but c++ is
provide default argument.
7) c is cant support the inheritance and polymorphism etc
but c++ support the inheritance and polymorphism etc.
8) c is low level language while c++ is sn high level
language.
9)C can not support all the feature of the C++. while c++
support all the features of C.
10. C variables are DECLARED in declaration section.C++
variables are DECLARED any where in the program.
11) C does NOT have NAMESPACE for avoid name collisions.
c++ has NAMESPACE feature.
| Is This Answer Correct ? | 15 Yes | 1 No |
Answer / chirag jobanputra
IN C,GLOBAL DECLARATION ISN'T POSSIBLE ANYWHERE BUT IN
C++,VARIABLES ARE DECLARED GLOBALLY.
| Is This Answer Correct ? | 21 Yes | 9 No |
Answer / sureshkumar koppineedi
C is a procedural oriented language .
c++ is a object oriented language.
OOps concepts are 1)encapsulation:-Taking data and methods
as an unit is called encapsulation.
2)Abstraction:-Hiding unnecessary data from the user is called
abstraction
3)Inheritence:-producing new classes from the existing classes.
4)Polymorphism:-Ability to exist in more than one form.
| Is This Answer Correct ? | 18 Yes | 6 No |
Answer / sandhya
c is not aobject orientedlanguage
c++ is object oriented language
c is a lowlevel language
c++ is a high level language
| Is This Answer Correct ? | 14 Yes | 2 No |
Answer / sindhu,swetha,charitha
in c we use scanf function as standard input
function,while
in c++ we use streame cin>> for input.like this for output
in c we use printf function,while in c++ we use cout<< as a
output function.
| Is This Answer Correct ? | 12 Yes | 0 No |
Answer / shailesh bahuguna(kec)
basically c does not support the object oriented features
that means we cannot relate the real world entities together
which can be expressed through C++ which is the extention of
c with OOPs concepts
there are many syntactic differences as well in c and c++.
C++ can be viewed as the revolution in the field of object
oriented programming paridigm.
| Is This Answer Correct ? | 14 Yes | 3 No |
Answer / ashish kumar
string variable take four bytes in c++ .whereas in c string
variable takes 3 bytes
c++ use bottom up approach to solve a problem.and c uses top
down approach to solve the problem.
c breaks the big problem into sub problems by using
procedures and function and then solve that.c++ combine the
small problems and then make it to be a solution.
| Is This Answer Correct ? | 17 Yes | 7 No |
Answer / ruchi chopra
in c++ the user define their own datadype i.e user-defined
datatype but in c there is by default datatypes.
| Is This Answer Correct ? | 18 Yes | 9 No |
Answer / bhoomi virani
c lang is procedure oriented programming in which we have
cann't have more flexibility because it follow sequence of
thing. where as, c++ is extended version of c and much use
now a day.
| Is This Answer Correct ? | 14 Yes | 5 No |
What is oops and its features?
different types of castings
Can bst contain duplicates?
#include <string.h> #include <stdio.h> #include <stdlib.h> #include <conio.h> void select(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); select(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void select(char *items, int count) { register int a, b, c; int exchange; char t; for(a = 0; a < count-1; ++a) { exchange = 0; c = a; t = items[ a ]; for(b = a + 1; b < count; ++b) { if(items[ b ] < t) { c = b; t = items[ b ]; exchange = 1; } } if(exchange) { items[ c ] = items[ a ]; items[ a ] = t; } } } design an algorithm for Selection Sort
difference between abstraction and encapsulation with progarammatic eg. hi,just recently i went for an interview .The interviewer asked what is the difference between abstraction and encapsulation with programmatic eg. I gave the answer as encapsulation mean hiding the relevant data which is not useful for the user, eg a electric fan .hiding the information how the electricity is converted into machanical energy. abtraction showing only the relevant data to the user eg electric fan. it look ,its color ,it design etc only relevant data. Then the interviewer asked me, give me some programmic eg .I Said Let assume a web form having control like textbox,button etc. The user can view textbox,button etc this is the eg of abstraction and when the user click on the button how he is redirected is not known by the user is the eg of the encapsulation. Am I Correct .was the answer given by me is perfect .now i am planing to go for an another interview should i give the same answer.IF not please suggest me a better answer.with some good eg Please help
Can private class be inherited?
what is a virtual class?
5 Answers Cap Gemini, IBM, Infosys, Trinity Technologies,
What is difference between polymorphism and inheritance?
What is an object?
Why can't we have instance(stack) of a class as a member of the same class like eg.Class A{A obj;} as we can have self refential pointer
i hav very low percentage in 12th n BSCwhich is around 50.......coz it was just imposed on me 2 b a science graduate,nw m doin MCA n hav aggregate 74% ....what shud i answer if company's HR ask me about dis much low previous percentage??????
what is the application of oops?