fork download
  1. #include <stdio.h>
  2. #include <malloc.h>
  3.  
  4. void f(char *buffer, int max){
  5. int i;
  6. printf("%s, ", buffer);
  7. for (i = max-1 ; buffer[i] == '1' ; i--){
  8. buffer[i] = '0';
  9. }
  10. if (i < 0) return;
  11. buffer[i] = '1';
  12. f(buffer, max);
  13. }
  14.  
  15. int main(int argc, char ** argv){
  16. int max = atoi(argv[1]);
  17. char buffer[32];
  18. int i;
  19. for (i = 0; i < max ; i++){
  20. buffer[i] = '0';
  21. }
  22. buffer[max] = 0;
  23. f(buffer, max);
  24. }
Runtime error #stdin #stdout 0s 9296KB
stdin
Standard input is empty
stdout
Standard output is empty