fork(2) download
  1. #include <algorithm>
  2. #include <iostream>
  3.  
  4. int main(void)
  5. {
  6. struct _
  7. {
  8. static void print(int i)
  9. {
  10. std::cout << i << " ";
  11. return;
  12. }
  13. };
  14.  
  15. // _::print(int) is local to this function
  16. int my_array[8] = {
  17. 0, 1, 2, 3, 4, 5, 6, 7
  18. };
  19. std::for_each(my_array, my_array + 8, _::print);
  20. std::cout << std::endl;
  21. return (0);
  22. }
  23.  
Success #stdin #stdout 0s 2728KB
stdin
Standard input is empty
stdout
0 1 2 3 4 5 6 7