fork(1) download
  1. #include <stdio.h>
  2. #include <memory.h>
  3.  
  4. void squeeze(char s[], char c);
  5. void str_cat(char s[], char t[]);
  6.  
  7. int main(void){
  8. char s[15] = "abcdef";
  9. char t[] = "ghi";
  10.  
  11. squeeze(s, 'd');
  12. printf("%s\n", s);
  13. str_cat(s, t);
  14. printf("%s\n", s);
  15.  
  16. return 0;
  17. }
  18.  
  19. void squeeze(char s[], char c){
  20. int i, j;
  21.  
  22. for(i = j = 0; s[i] != '\0'; i++)
  23. if(s[i] != c)
  24. s[j++] = s[i];
  25. s[j] = '\0';
  26. }
  27.  
  28. void str_cat(char s[], char t[]){
  29. int i, j;
  30.  
  31. i = j = 0;
  32. /*Поиск конца строки ss*/
  33. while(s[i] != '\0') i++;
  34. /*Копирование строки t в конец строки s*/
  35. while((s[i++] = s[j++]) != '\0');
  36. }
Runtime error #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Standard output is empty