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's wrong with "char *p = malloc(10);" ?

Answer Posted / guest

malloc returns a void pointer. It needs to be cast to char*
before allocating it to char* variable.
char *p = (char *)malloc(10); should do fine.

Is This Answer Correct ?    26 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is || operator and how does it function in a program?

1161


How to Throw some light on the splay trees?

1101


What is main () in c?

1117


What does struct node * mean?

1068


What is difference between constant pointer and constant variable?

1402


What is the significance of c program algorithms?

1193


What is wrong with this program statement?

1088


How to write c functions that modify head pointer of a linked list?

1032


Explain how do you determine whether to use a stream function or a low-level function?

1135


exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above

1180


What is nested structure in c?

1117


The file stdio.h, what does it contain?

1214


Why c is known as a mother language?

1131


simple program of graphics and their output display

2049


What's the difference between constant char *p and char * constant p?

1191