fork(1) download
  1. #include <algorithm>
  2. #include <iostream>
  3.  
  4. bool is_bad (const char &c) { return c == 'a'; }
  5.  
  6. int main (int argc, char *argv[]) {
  7. char test1[] = "123a45";
  8. std::cout << test1 << std::endl;
  9. char * new_end = std::remove_if(test1, test1 + sizeof(test1), is_bad);
  10. *new_end = '\0';
  11. std::cout << test1 << std::endl;
  12.  
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
123a45
12345