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
Explain what is the heap?
I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.
What are static variables in c?
What is assert and when would I use it?
Why static is used in c?
write a progrmm in c language take user interface generate table using for loop?
What is the use of typedef in c?
What is size of union in c?
What is the difference between functions abs() and fabs()?
What are examples of structures?
What is sizeof in c?
Can static variables be declared in a header file?
Explain the difference between malloc() and calloc() function?
Why do we use null pointer?
Is calloc better than malloc?