I am pretty new programming on Mac (osx: Sierra 10.12.6) so it could be a very stupid question. I was working on couple Linked List operations, everything works as expected unless sometimes when I do not restart Mac for couple days then some type casting errors show up. Although casting type can remove the errors but normally I do not need to cast types for malloc() while using C language. Even those programs I have compiled earlier without error will show up with some errors like the following:
error: assigning to 'node *' (aka 'node_t *') from incompatible type 'void *'
head = malloc(sizeof(head));
error: cannot initialize a variable of type 'node *' (aka 'node_t *') with an rvalue of type 'void *'
node *current = malloc(sizeof(current));
After restarting the terminal and completely shutting down the computer and starting again can get rid of this issue and those programs can compile again without error. I will appreciate if anyone can help me with this problem so even if I do not restart Mac for some weeks or long I would not get these errors.