Allocating char array using malloc
Yes, it’s a matter of style, because you’d expect sizeof(char) to always be one. On the other hand, it’s very much an idiom to use sizeof(foo) when doing a malloc, and most importantly it makes the code self documenting. Also better for maintenance, perhaps. If you were switching from char to wchar, you’d switch to … Read more