What's wrong with "char *p; *p = malloc(10);"?

Answer Posted / shruti

the syntax of malloc is wrong.

in your example it should be written as:

char *p;

p = (char *)malloc(sizeof(char));

Is This Answer Correct ?    21 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I need previous papers of CSC.......plz help out by posting them.......

1817


In C programming, what command or code can be used to determine if a number of odd or even?

622


explain what are actual arguments?

635


What are enums in c?

661


What is keyword in c?

604






What is difference between Structure and Unions?

640


What is getch?

633


What is void main ()?

611


What is the difference between c and python?

586


How can I copy just a portion of a string?

816


What is the size of enum in c?

620


What are pointers? What are stacks and queues?

579


What are the advantages of using new operator as compared to the function malloc ()?

758


hi send me sample aptitude papers of cts?

1654


What is a null string in c?

589