http://kor.i2p/books/The%20C%20Programming%20Language%20by%20K&R/chapter7.html
The pointer returned by malloc or calloc has the proper
alignment for the object in question, but it must be cast into the
appropriate type, as in int *ip;
ip = (int *) calloc(n, sizeof(int)); free(p) frees the space pointed to by p , where p was originally obtained by a call to malloc or calloc .
There are no restrictions on the order in which space is freed, but it is a
ghastly error to free something not obtained by calling malloc or calloc .