I'm trying to reverse a c string. I know of easier ways to do this but I was trying to practice some pointers. This compiles but returns a null string and I do not understand why. What am I missing here?
#include <stdio.h>
#include <stdlib.h>
int main(){
char *forwards, *backwards;
forwards = "hello";
backwards = (char*) malloc( strlen(forwards) );
int i;
for( i = strlen(forwards) - 1; i >=0; --i )
backwards[ strlen(forwards) - i ] = forwards[i];
printf("%s", *backwards );
return 0;
}