implement reverse word order using C code rather than C++