The program should store a character array in reverse order then display the reversed array. I have also included in the code that will display the actual characters into the array as it loops through. So I know the characters are being stored, but why doesn't it display the entire string when I call it?
Is it just my compiler?Code:#include<stdio.h> int main() { char str[50]; char rev[50]; printf("Enter Desired Text: "); scanf ("%[^\n]%*c", str); int i=0,j=0,k=0; while(str[i++]!='\0'); while(i>=0) { rev[++j]=str[--i]; /*Just Double checking What should go into the array*/ printf("%c",rev[j]); } rev[j]='\0'; printf("\n"); printf("String: %s ",rev); return 0; }