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 available in C language but not in C++?

Answer Posted / preeti singh

C allows a void* pointer to be assigned to any pointer type
without a cast, whereas C++ does not.

void* ptr;
int *i = ptr;

int *j = malloc(sizeof(int) * 5);

this is valid in C but not in C++.
In C++ explicit cast needs to be applied as given below.

void* ptr;
int *i = (int *) ptr;

int *j = (int *) malloc(sizeof(int) * 5);

Is This Answer Correct ?    13 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are identifiers c?

1017


Explain what is the best way to comment out a section of code that contains comments?

1091


What is class and object in c?

1044


Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?

1047


Is r written in c?

1106


Why functions are used in c?

1066


Which is best book for data structures in c?

1038


How can I implement sets or arrays of bits?

987


The statement, int(*x[]) () what does in indicate?

1079


What is the total generic pointer type?

1103


what is a function method?give example?

2309


What is 'bus error'?

1085


Explain that why C is procedural?

1081


Which is better pointer or array?

968


What should malloc(0) do?

1053