struct LLNode *initLLNode(char val){
struct LLNode *temp;
temp=(struct LLNode *)malloc(sizeof(struct LLNode));
temp->next=NULL;
temp->key=val;
return(temp);
}
i have these lines of code...the line which puzzles me is the line with (struct LLNode *) next to malloc
wat is its purpose there?



LinkBack URL
About LinkBacks



C allows implicit conversion from a void* to any pointer type (except function pointers). The cast is unnecessary and dangerous as it potentially hides the error of not including stdlib.h. The preferred way to call malloc in the C community is as follows: