… is a matter most c programmers have questioned themselves about once or twice, at least, by now. to do or not to do, that is the question! i have been recently penalized by 2.5 percent in a program, along with a colleague, by not casting the result of the malloc function (a pointer to void, void *) to whatever type we want to use. we have questioned ourselves sometimes before the submission of the work, and so we went and searched for it on google. small forum conversations and programming tutorials suggested that this was no longer necessary, since the void pointer was created to leave the char pointer behind as the arbitrary pointer to objects (data). that was when we decided not to cast.
Continue reading
casting malloc…
Reply