Based on this old question malloc
returns a pointer to void
that it
is automatically and safely promoted to any other pointer type
But reading K&R I've found this following code
char *strdup(char *s)
{
char *p;
/* make a duplicate of s */
p = (char *) malloc(strlen(s)+1)
What is the difference?
No comments:
Post a Comment