C examples for Array:Array Value
Use strlen() to compute the index of the last character in the array.
#include <stdio.h> #include <string.h> int main(void){ char word[30];/* w w w.j a va 2 s. c om*/ printf("Enter a string: "); scanf("%s", word); for (int i = strlen(word) - 1; i >= 0; i--){ printf("%c", word[i]); } return 0; }