Please help me by giving the code preferably in C.
That's not gonna happen. Sorry, but this reeks of homework and if we gave you the code then you wouldn't learn anything. But here's a hint: Reverse each word, then reverse the whole string. You can do an in-place reversal by swapping characters from the outside in.