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 behaviour of C and C++ compiler for the below
statements.
int *p;
p = malloc(100);

Is the behaviour same ? or different ?

Answer Posted / pramodsingh_45

In "C" the implicit typecasting will be done from void* to
int* but in C++ we need to do explicit typecasting.

so in C++
p = (int*)malloc(100);
but in C
p = malloc(100) will also work.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by function pointer?

1043


Differentiate between C and C++.

1172


Differentiate between a template class and class template in c++?

1049


What is an associative container in c++?

1007


Can we use struct in c++?

968


Can non-public members of another instance of the class be retrieved by the method of the same class?

1029


What is implicit pointer in c++?

1032


Why c++ is called oop?

1054


Why pointer is used in c++?

1083


How do I make turbo c++ full screen?

1025


What is virtual base class?

1006


Why is it necessary to use a reference in the argument to the copy constructor?

1066


What is this pointer in c++?

1308


How can I learn c++ easily?

1017


what is Loop function? What are different types of Loops?

1163