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

a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode

1120


What are the advantages and disadvantages of a heap?

1211


Why do we use c for the speed of light?

1206


Write a program to print fibonacci series using recursion?

1062


There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?

1299


How do you define structure?

1041


What are the disadvantages of a shell structure?

1350


what value is returned to operating system after program execution?

2118


List some basic data types in c?

1028


What are types of structure?

1119


Explain how can a program be made to print the line number where an error occurs?

1211


How variables are declared in c?

1041


Can you please explain the difference between syntax vs logical error?

1188


Is it acceptable to declare/define a variable in a c header?

1121


What is array of structure in c?

1174