what is the main difference between c and c++?
Answers were Sorted based on User's Feedback
Answer / sambi reddy
c is not a object oriented language but in c++ is object oriented programming language
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ashish
DIFFERENCE b/w C and C++
1.) C was the C++ predecessor. As its name implies,
alot of
C remains in C++. Although not actually being more powerful
than C, C++ allows the programmer to more easily manage and
operate with Objects, using an OOP (Object Oriented
Programming) concept.
2.) C++ allows the programmer to create classes, which
are
somewhat similar to C structures. However, to a class can be
assigned methods, functions associated to it, of various
prototypes, which can access and operate within the class,
somewhat like C functions often operate on a supplied
handler pointer.
3.) Although it is possible to implement anything
which C++
could implement in C, C++ aids to standardize a way in which
objects are created and managed, whereas the C programmer
who implements the same system has alot of liberty on how to
actually implement the internals, and style among
programmers will vary alot on the design choices made.
4.) In C, some will prefer the handler-type, where a
main
function initializes a handler, and that handler can be
supplied to other functions of the library as an object to
operate on/through. Others will even want to have that
handler link all the related function pointers within it
which then must be called using a convention closer to C++.
5.) In C, there's only one major memory allocation
function:
malloc. You use it to allocate both single elements and
arrays. In C++, however, memory allocation for arrays is
somewhat different than for single objects; you use the
new[] operator, and you must match calls to new[] with calls
to delete[] (rather than to delete).
6.) C++ applications are generally slower at runtime,
and
are much slower to compile than C programs. The low-level
infrastructure for C++ binary execution is also larger. For
these reasons C is always commonly used even if C++ has alot
of popularity, and will probably continue to be used in
projects where size and speed are primary concerns, and
portable code still required (assembly would be unsuitable
then).
7.) In C++, you are free to leave off the
statement 'return
0;' at the end of main; it will be provided automatically
but in C, you must manually add it.
8.) A function can be declared in C as int fun( );. This
means that fun( ) is a function without any argument or any
number of arguments. But in C++, this means that the
function with no argument at all.
9.) C++ support operator overloading but c doesn't
support
operator overloading.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / jyotsna
C
c is a procedural programming language
in c we use printf function
in c we use scanf function as standard input
c-programe the main function could not return a value
in c we use #include<stdio.h>as inclusion file
c is a topdown approach
In C memory allocation is done with malloc statement
memory is
deallocated in C using free statement
In C DATA IS NOT SECURED
FOCUS ON PROCEDURES
PROGRAMS ARE DECOMPOSED
INTO FUNCTIONS
DOES NOT PROVIDE
DEFAULT ARGUMENTS
c is low level language
In C,DATA can be MOVE openly around in the system from
function to function
C is a collection of FUNCTIONS.
C++
c++ is object oriented
in c++ we use cout<< as a
output function.
in c++ we use streame cin>> for input
in the c++ the main function should return a value
In c++ we use #include<iostreame>as inclusion file.
c++ is bottom up approach
in C++ it is done through new keyword
in C++
deallocation takes place through delete.
In C DATA IS SECURED
FOCUS ON DATA
INTO OBJECTS
PROVIDES
c++ is sn high level language
In C++,DATA is HIDDEn.It can not be accessed by external
Functions
C++ is a collection of FUNCTIONS and/or CLASS.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / prem chand bairwa
c language is a procedure oriented programming and also law level language but c++ is object oriented programming language and also known as high level language
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / muthu sundar
The main difference between C and C++ is
polymorphism which is present in C++ and not in C.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / alok singh,pit
c is a topdown approach while c++ is bottom up APPROACH. C++ support operator overloading but c doesn't support
operator overloading.
In C++, you are free to leave off the statement 'return
0;' at the end of main; it will be provided automatically
but in C, you must manually add it
Actually c is a procedural programming language which
cann't face the real world problem. It has some drawback
like a global data is shared by all function and if in a
large program it is find out difficult that which function
uses which data.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / adil siddiqui
1.C is a structured programming language while C++ is an
object programming language .
2.c++ support operator overloading but c doesn't support
operator overloading
3. C employs top down approach, but c++ employes buttom up
approach.
4.C give emphasis in algorithims and functions, but C++
give emphasis on the data and objects.
5.In C we are using #include<stdio.h> as header file, but
in C++ we are using #include<iostream.h> as header file.
6.In C memory allocation is done with malloc statement
whereas in C++ it is done through new keyword.Also memory
is deallocated in C using free statement while in C++
deallocation takes place through delete.
7. *Inline functions are not available in C.
8.The I/O functions are entirely different in C and C++
(ex: printf( ), scanf( ) etc. are part of the C language).
9.Structures in C cannot have functions
10.You cannot overload a function in C (i.e. you cannot
have 2 functions with the same name in C).
11.C does not have reference variables (in C++
referencevariables are used in functions).
12.In other worlds C is used more with hardware while C++
is used more with software, mainly because of more
abstraction and features in C++.
13.You have to include the struct keyword before the name
of the struct type to declare a struct: In C++, you could
do this, and have a new instance of a_struct called
struct_instance. In C, however, we have to include the
struct keyword when declaring struct_instance
14.C++ has a much larger library than C, and some things
may be automatically linked in by C++ when they are not
with C.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / er.rajeev yadav
here are some difference between c and c++ ---
1. C is a PROCEDURE oriented programming language.
-> C++ is a OBJECT oriented programming language.
2. We can do programming through STRUCTURE,but NOT with the
help of the CLASS.
-> We can do programming through CLASS in c++.
3. C is a LOW level language.
->C++ is a HIGH level language.
4. C is a TOP->BOTTOM programming approch.
->C++ is a BOTTOM->TOP programming approch.
5. C is a collection of FUNCTIONS.
-> C++ is a collection of FUNCTIONS and/or CLASS.
6. c language main focuses on PROCEDURES.
-> c++ programming main focuses on OBJECTS.
7. In C,DATA can be MOVE openly around in the system from
function to function.
-> In C++,DATA is HIDDEn.It can not be accessed by external
functions.
8.C can not support all the feature of the C++.while c++
support all the features of C.
9. C NEEDS FORMAT CHARACTERS for printing & scanning.
-> C++ DOES NOT REQUIRED FORMAT SPECIFIER for printing and
scanning variable.
10. C variables are DECLARED in declaration section.
-> C++ variables are DECLARED any where in the program.
11. In C,we use PRINTF() ,SCANF() as standard input/output
functions.
-> In C++,we can use COUT<< or CIN>> as standard
input/output function.
12. In C,you can NOT OVERLOAD a function.
-> In C++ ,you can OVERLOAD the operator as well as
functions.
13. C does NOT have NAMESPACE for avoid name collisions.
-> c++ has NAMESPACE feature.
14.C does NOT have REFERENCE variables.
-> In C++ ,REFERENCE variables are USED in functions.
15. In C,constants are defined as 'MACROS'.
-> We can make a use of 'CONST' TO declare a constant.
16.In C program , the MAIN() should NOT RETURN a value.
-> In C++,MAIN() should RETURN a value.
17. C does NOT SUPPORT DEFAULT arguments.
-> C++ PROVIDES DEFAULT argument concept.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / deepak
c is structure programming language while c++ is object oriented programming language this is the main difference between c and c++
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / mayank jain
In early stage c++ is also known as "c with classes".Therefore c++ contain classes.
Is This Answer Correct ? | 1 Yes | 0 No |
Can we create object of abstract class?
How do you use inheritance in unity?
what about you? wahat is your object? introduce your self?
1 Answers Ajmal Perfumes, TCS,
Write a program to sort the number with different sorts in one program ??
What is this pointer in oop?
We have a scale and 7 balls. 1 ball is heavier than all the rest. How to determine the heaviest ball with only 3 possible weighing attempts?
What is a friend function & its advantage?
What are main features of oop?
What is the difference between the C & C++?
WHAT'S THE OOPS BASIC OOPS CONCEPTS IN DOTNET
What is protected in oop?
What is data binding in oops?