Advertisement
sanpai

String Reverse

Dec 29th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #define MAXLNE 200
  4.  
  5. int main()
  6. {
  7. int len,i,j=0;
  8. char input[MAXLNE]="hello",output[MAXLNE];
  9. // printf("Enter the sentence : ");
  10. // scanf("%s",input);
  11. len=strlen(input);
  12. printf("Len= %d \n",len);
  13. i=len-1;
  14. while(i>=0)
  15. {
  16. output[j]=input[i];
  17. j++;
  18. i--;
  19. }
  20. output[j]='\0';
  21.  
  22. printf("The output sentence : %s ",output);
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement