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 is #error and use of it?

1348


How are 16- and 32-bit numbers stored?

1327


What would be an example of a structure analogous to structure c?

1049


p*=(++q)++*--p when p=q=1 while(q<=6)

1816


What is a union?

1092


Explain why c is faster than c++?

1126


What is bubble sort in c?

1104


Does free set pointer to null?

1066


What does sizeof return c?

1130


c program to compute AREA under integral

2468


Is there anything like an ifdef for typedefs?

1222


What the advantages of using Unions?

1294


Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.

2368


Why is main function so important?

1162


An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

1218