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 ?

Answers were Sorted based on User's Feedback



what is the behaviour of C and C++ compiler for the below statements. int *p; p = malloc(100); ..

Answer / venu

we should explicitly typecast. Otherwise it is give a
compilation error.

Is This Answer Correct ?    3 Yes 0 No

what is the behaviour of C and C++ compiler for the below statements. int *p; p = malloc(100); ..

Answer / 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

More C++ General Interview Questions

What is an Iterator class?

1 Answers  


How size of a class can be calulated?

2 Answers  


What are the techniques you use for debugging?

1 Answers   Adtran,


What is Object Oriented programming.what is the difference between C++ and C?

8 Answers   Infosys,


Write a function that swaps the values of two integers, using int* as the argument type?

0 Answers  


Can turbo c++ run c program?

0 Answers  


List the advantages of inheritance.

0 Answers  


How can a struct in c++ differs from a struct in c?

0 Answers  


If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?

0 Answers  


Is swift better than c++?

0 Answers  


What's the hardest coding language?

0 Answers  


Can I make ios apps with c++?

0 Answers  


Categories