@JamesKilton said:
I take it you're not at all familiar with pointers and manual memory management.
.... snipping some BS
I highly recommend a basic C programming book. Go read about and learn how memory allocation and pointers work.
... says the guy who doesn't have a clue.
First, in C (not C++) casts between void* and any pointer type are implicit. int* p = malloc(32); will compile just fine on any compiler (in C mode, mind you)
Second, sizeof is evaluated during compilation (yes, there're exceptions, but that's irrelevant to this discussion) so int* p = malloc(5*sizeof(*p)) is also perfectly fine. The compiler only cares about the type of *p which is known at compile time and whether p is allocated, 0 or 0xdeadbeef at runtime couldn't matter less.
And please, don't involve Jeff Attwood when discussing techincal matters, I'm actually glad that he spends his time blogging instead of coding (and at the same time horrified by the fact that there are probably beginners who take his words seriously)