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

How the delete operator differs from the delete[]operator?

1092


What is c++ virtual inheritance?

1130


Explain one-definition rule (odr).

1116


Is c++ the best programming language?

1011


Can we run c program in turbo c++?

1078


What is an accessor in c++?

1068


What is namespace & why it is used in c++?

1110


Which coding certification is best?

1021


What is a container class? What are the types of container classes in c++?

1252


What is time h in c++?

1133


What do you understand by pure virtual function? Write about its use?

998


Are strings immutable in c++?

1149


Is the declaration of a class its interface or its implementation?

1166


write a program that withdrawals,deposits,balance check,shows mini statement. (using functions,pointers and arrays)

2375


How would you obtain segment and offset addresses from a far address of a memory location?

1072