Hello all, newbie here and yes I am trying to do homework. I have spent the last couple days searching the forums trying to learn. I havent been in school in years (lots of years) and I am struggling with some of the concepts. I dont want anyone to do my homework I just want to learn.
I need to code a program that asks the user to input a line of text and then prints the text in reverse. Here is what I have so far. Any suggestions on what I am missing or what I should go read/study would be appreciated. Am I barking up the wrong tree using strlen?
Code:#include <stdio.h> #include <string.h> int main(void) { char text[500]; int letters = 0; printf("Please enter a line of text.\n"); gets(text); letters = strlen(text)-1; while (letters <= 0) { printf("Your reversed text reads: %s\n", text[letters]); --letters; } getchar(); getchar(); return 0;