Implementation of a program to reverse a string in c