C implementation of reverse string