fork download
  1. #include<stdio.h>
  2.  
  3. void StrlDel(char *s1, char *s2) {
  4. int i = 0;
  5. int notFound = 1;
  6. while (s1[i]) {
  7. int j;
  8. for (j = 0; s2[j] && s2[j] == s1[i + j]; j++);
  9. if (!s2[j] && notFound) {
  10. int k;
  11. for (k = i; s1[k + j]; k++) s1[k] = s1[k + j];
  12. s1[k] = 0;
  13. notFound = 0;
  14. } else i++;
  15. }
  16. }
  17.  
  18. int main(void) {
  19. char palavras[] = "O rato roeu a rolha da garrafa";
  20. StrlDel(palavras, "ra");
  21. printf("\n%s\n", palavras);
  22. }
  23.  
  24. //https://pt.stackoverflow.com/q/398277/101
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
O to roeu a rolha da garrafa