ok for this exercise i had to put in the entered word into an array and print it backwords... i was able to do it but in a bad way heres my code:
Code:
#include <stdio.h>
#include <string.h>
int main(void)
{
char c[20],index,word;
int i;
printf("Enter a word: ");
scanf("%s", c);
word = strlen(c);
printf("Please enter the word again: ");
for(i = 0; i <= word; i++)
scanf("%c", &c[index]);
for(i = word; i >= 0; i--)
printf("%c", c[i]);
printf("\n");
return 0;
}
how can i do this without having to enter the word twice?