fork download
  1. #include <stdio.h>
  2.  
  3. char list[10];
  4.  
  5. void show(int n) {
  6. printf("(%c", list[0]);
  7. for (int i = 1; i < n; i++)
  8. printf(",%c", list[i]);
  9.  
  10. printf(")\n");
  11. }
  12.  
  13. void Swap(int k, int i) {
  14. int temp = list[k];
  15. list[k] = list[i];
  16. list[i] = temp;
  17. }
  18.  
  19. void Perm(int k, int n) {
  20. if() {
  21.  
  22. }
  23.  
  24. for(int i = k; i < n; i++) {
  25. Swap(k, i);
  26. show(n);
  27. Perm(++k, n);
  28. Swap(i, k);
  29. }
  30. }
  31.  
  32. int main(void) {
  33. int num;
  34.  
  35. scanf("%d", &num);
  36.  
  37. for(int i = 0; i < num; i++)
  38. list[i] = '1' + i;
  39. Perm(0, num);
  40.  
  41.  
  42. return 0;
  43. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘Perm’:
prog.c:20:8: error: expected expression before ‘)’ token
     if() {
        ^
stdout
Standard output is empty