fork download
  1.  
  2. #include <stdio.h>
  3.  
  4.  
  5. char* s_cut(char* s, char c){
  6. char* p, *t;
  7. while(*s && (*s != c))
  8. ++s;
  9.  
  10. t = NULL;
  11. for(p = s; *p; ++p){
  12. if(*p == c)
  13. t = p;
  14. }
  15.  
  16. if(t != NULL)
  17. *t = '\0';
  18. return s;
  19. }
  20.  
  21.  
  22. int main(void){
  23. char s[64] = "bla-bla+begin end+ off+fin+end bla-bla";
  24. /*
  25. printf("Enter str: ");
  26. fgets(s, sizeof(s), stdin);
  27. fflush(stdin);
  28. */
  29. puts( s_cut(s, '+') );
  30. return 0;
  31. }
Success #stdin #stdout 0s 2052KB
stdin
Standard input is empty
stdout
+begin end+ off+fin