Should I cast the result of malloc (in C)?
No; you shouldn’t cast the result, since: It is unnecessary, as void * is automatically and safely promoted to any other pointer type in this case. It adds clutter to the code, casts are not very easy to read (especially if the pointer type is long). It makes you repeat yourself, which is generally bad. … Read more