(char *) malloc(200)
Should be "malloc(sizeof(char)*200)".
The return value of malloc should not be cast as it can mask a missing include of stdlib.h. It's a best practice to use the sizeof multiplier as malloc takes a number of bytes to allocate and not the number of elements of the target type (which it can't possibly know).
Share this highlighthttp://www.safaribooksonline.com/a/hacking-the-art/403256/