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
What is || operator and how does it function in a program?
How to Throw some light on the splay trees?
What is main () in c?
What does struct node * mean?
What is difference between constant pointer and constant variable?
What is the significance of c program algorithms?
What is wrong with this program statement?
How to write c functions that modify head pointer of a linked list?
Explain how do you determine whether to use a stream function or a low-level function?
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
What is nested structure in c?
The file stdio.h, what does it contain?
Why c is known as a mother language?
simple program of graphics and their output display
What's the difference between constant char *p and char * constant p?