Advertisement
veto14

Q8Exercicios1

Mar 28th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. void rodastring (char* string);
  6.  
  7. int main(void){
  8. char words[30];
  9. fgets(words,30,stdin);
  10. rodastring(words);
  11. return 0;
  12. }
  13.  
  14. void rodastring (char* string){
  15. int len,i;
  16. len = strlen(string) - 1;
  17. char *v;
  18. v = (char *)malloc (len*sizeof(char));
  19. v[0] = string[len-1];
  20. for(i=1; i<len; i++){
  21. v[i] = string[i-1];
  22. }
  23. printf("%s",v);
  24. free(v);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement