mohi <mo**********@gmail.comwrites:
as i have noted a lot many times it has been mentioned that we shudn't
cast pointers returned by malloc()
i mean
its been said that use
node * nod=malloc(sizeof(node));
instead of
node * nod=(node *) malloc( sizeof(node));
but when i use the upper way my gcc compiler shows error like
invalid conversion from void* to node*
whats the matter ?
Does it show an error *like* "invalid conversion from void* to node*",
or does it show that exact error?
I might expect to see an error message about converting from int to
node* if you forgot the mandatory "#include <stdio.h>".
If that doesn't help, read question 7.6 of the comp.lang.c FAQ,
<http://www.c-faq.com/>, and in the future please check the FAQ before
posting. If that doesn't help, read the rest of section 7, and
perhaps the entire FAQ. And if *that* doesn't help, feel free to post
again -- but *please* copy-and-paste your actual complete program and
the exact error message.
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"