Advertisement
poczatkujacykoder

Untitled

Sep 9th, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2. #include<stdlib.h>
  3. #include <conio.h>
  4. #include <string.h>
  5.  
  6.  
  7. void odwrocenie (char *s) ;
  8.  
  9. int main ()
  10. {
  11. char ciag_znakow[30] = "przypadkowy ciag znakow" ;
  12. odwrocenie(ciag_znakow) ;
  13.  
  14. printf("ciag znakow po odwroceniu: %s\n", ciag_znakow);
  15.  
  16. system ("pause") ;
  17. return 0;
  18. }
  19. void odwrocenie(char *s){
  20.  
  21. //char *wsk = s + strlen(s)-1 ;
  22.  
  23. char *wsk ;
  24. *wsk = s + strlen(s)-1 ;
  25.  
  26. char temp;
  27.  
  28. for (;wsk>s ; wsk--,s++) {
  29. temp = *s ;
  30. *s = *wsk ;
  31. *wsk = temp;
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement