fork download
  1. #include <stdio.h>
  2.  
  3. int result[10];
  4. int check[10];
  5.  
  6. int go(int position,int n,int r){
  7. int i;
  8. int start=1;
  9.  
  10. if(position==r){
  11. for(i=0;i<r;i++){
  12. printf("%d ",result[i]);
  13. }
  14. printf("\n");
  15. return;
  16. }
  17.  
  18. if(position>0){
  19. start=result[position-1]+1;
  20. }
  21.  
  22. for(i=1;i<=n;i++){
  23. if(check[i]=0){
  24. check[i]=1;
  25. result[position]=i;
  26. go(position+1,n,r);
  27. check[i]=0;
  28. result[position]=0;
  29. }
  30. }
  31. }
  32.  
  33. void main(){
  34. int n=5
  35. int r=5;
  36. //scanf("%d %d",&n,&r);
  37. go(0,n,r);
  38. return 0;
  39. }
Compilation error #stdin compilation error #stdout 0s 9432KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘go’:
prog.c:15:1: warning: ‘return’ with no value, in function returning non-void
 return;
 ^~~~~~
prog.c:6:5: note: declared here
 int go(int position,int n,int r){
     ^~
prog.c:23:1: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
 if(check[i]=0){
 ^~
prog.c:8:5: warning: variable ‘start’ set but not used [-Wunused-but-set-variable]
 int start=1;
     ^~~~~
prog.c: At top level:
prog.c:33:6: warning: return type of ‘main’ is not ‘int’ [-Wmain]
 void main(){
      ^~~~
prog.c: In function ‘main’:
prog.c:35:1: error: expected ‘,’ or ‘;’ before ‘int’
 int r=5;
 ^~~
prog.c:37:8: error: ‘r’ undeclared (first use in this function)
 go(0,n,r);
        ^
prog.c:37:8: note: each undeclared identifier is reported only once for each function it appears in
prog.c:38:8: warning: ‘return’ with a value, in function returning void
 return 0;
        ^
prog.c:33:6: note: declared here
 void main(){
      ^~~~
stdout
Standard output is empty