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 the difference between break and continue?

1523


What oops means?

1001


How can I discover how many arguments a function was actually called with?

1067


What do you understand by friend-functions? How are they used?

1208


Simplify the program segment if X = B then C ← true else C ← false

3015


Is c++ based on c?

1070


What are the benefits of organizational structure?

1020


What are types of structure?

1119


What is a class c rental property?

1093


What is masking?

1151


Can you please compare array with pointer?

1086


Why c is called free form language?

1022


What is the size of enum in c?

1117


5 Write an Algorithm to find the maximum and minimum items in a set of ā€˜n’ element.

2109


How do you define a string?

1103