fork download
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. int main() {
  5. char str[100], temp;
  6. int i, j = 0;
  7.  
  8. printf("\nEnter the string :");
  9. gets(str);
  10.  
  11. i = 0;
  12. j = strlen(str) - 1;
  13.  
  14. while (i < j) {
  15. temp = str[i];
  16. str[i] = str[j];
  17. str[j] = temp;
  18. i++;
  19. j--;
  20. }
  21.  
  22. printf("\nReverse string is :%s", str);
  23. return (0);
  24. }
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
Enter the string :
Reverse string is :