FA> char *txt;char *pat;char *ptr;
FA> txt = (char*) malloc(strlen(buf)+1);
FA> pat = (char*) malloc(strlen(wrd)+1);
DN>Just out of interest, why cast the return from malloc()? If it is
DN>because it has no prototype, then you should do the /correct/ thing
DN>and include stdlib.h.
AF> Eh? I thought it was because malloc returns a void*, and most compilers
AF> will give you a warning because a char* is different to a void*.
"void *" is designed to "match any pointer", and you
can freely convert from "void *" to any other data pointer, there
is nothing suspicious about it, so there's no need for a warning. In C++
they decided to tighten that up. BFN. Paul.
@EOT:
---
* Origin: X (3:711/934.9)
|