fork(1) download
  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include <string.h>
  4.  
  5. char *enleve_espace(char *txt)
  6. {
  7. char *end;
  8. while(isspace(*txt))
  9. txt ++;
  10. if(*txt == 0)
  11. return txt;
  12. end = txt + strlen(txt) - 1;
  13. while(end > txt && isspace(*end))
  14. end --;
  15. *(end+1) = 0;
  16.  
  17. return txt;
  18. }
  19.  
  20. int main(void) {
  21. char test[] = " ceci est un test ";
  22. printf(enleve_espace(test));
  23. return 0;
  24. }
Success #stdin #stdout 0s 2008KB
stdin
Standard input is empty
stdout
ceci est un test