Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Answer Posted / ravi kumar martha

1. C is a general programming language. C++ is an Object
Oriented variant of C.

2.C++ was based on C and retains a great deal of the
functionality.
C++ does not retain complete source-level compatability
with C.

3.
In C, there's only one major memory allocation function:
malloc. You use it to allocate both single elements and
arrays and you always release the memory in the same way.

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).

4.Although most good C code will follow this convention, in
C++ it is strictly enforced that all functions must be
declared before they are used. This code is valid C, but it
is not valid C++.

5.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

6.you must include the keyword enum; in C++, you don't have
to. As a side note, most C programmers get around this
issue by using typedefs.

7.C++ has a much larger library than C, and some things may
be automatically linked in by C++ when they are not with C.
For instance, if you're used to using g++ for math-heavy
computations, then it may come as a shock that when you are
using gcc to compile C, you need to explicitly include the
math library for things like sin or even sqrt.

8.C does not provide a native boolean type. You can
simulate it using an enum, though.

9.In C++, you are free to leave off the statement 'return
0;' at the end of main; it will be provided automatically.

Is This Answer Correct ?    15 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

c++ program to swap the objects of two different classes

2422


What is oops with example?

1049


What is difference between inheritance and polymorphism?

1029


What is the important feature of inheritance?

1143


What is the oops and benefits of oops programming?

976


Question In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Question Submitted By :: Sunil Kumar I also faced this Question!! Rank Answer Posted By Re: In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Answer # 1 use copy constructors 0 Shanthila There is something to be taken care in destructor, in copy constructor, suppose the memory is assigned to the embedded member object pointer with the parameter passed value, but if some other objects of different class also are pointing to this memory, then if some one deletes the object then this class member pointer object will become dangling, or if the object is not deleted properly then there will be memory leak. Please suggest the design change required to handle or avoid this situation

2131


What is the fundamental idea of oop?

1141


What is meant by oops concept?

1044


can we make game by using c

4148


how to get the oracle certification? send me the answer

2160


Why is destructor used?

1024


What do you mean by Encapsulation?

1094


What is multilevel inheritance in oop?

1043


hi, this is raju,iam studying b.tech 2nd year,iam want know about group1 and group2 details, and we can studying without going to any instutions? please help me.

1955


Advantage and disadvantage of routing in telecom sector

1308