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

Is c++ low level?

1073


What does new do in c++?

1125


What function initalizes variables in a class: a) Destructor b) Constitutor c) Constructor

1205


What language is a dll written in?

1068


How do you save a c++ program?

1086


What is general form of pure virtual function? Explain?

1038


What are manipulators in c++ with example?

1113


Does a derived class inherit or doesn't inherit?

1123


Difference between Abstraction and encapsulation in C++?

1208


Is facebook written in c++?

1051


What is c++ code?

1176


What is a breakpoint?

1075


Difference between pointer to constant vs. Pointer constant

1210


Evaulate: 22%5 a) 2 b) 4 c) 0

1141


What is malloc in c++?

1068