Skip to content
Snippets Groups Projects
Select Git revision
  • 19c17aca883dc392bef7d185c6dc60860235a64c
  • master default protected
  • 2018ws
  • 2017ws
  • 2016ws
5 results

hanoi-1.c

Blame
  • Forked from Peter Gerwinski / hp
    49 commits behind the upstream repository.
    hanoi-1.c 433 B
    #include <stdio.h>
    
    #define DISKS 4
    
    int n[3], tower[3][DISKS];
    
    void display (void)
    {
      printf ("\n");
      for (int i = 0; i < 3; i++)
        {
          printf ("tower %d:", i);
          for (int j = 0; j < n[i]; j++)
            printf (" %d", tower[i][j]);
          printf ("\n");
        }
    }
    
    int main (void)
    {
      n[0] = 4;
      tower[0][0] = 4;
      tower[0][1] = 3;
      tower[0][2] = 2;
      tower[0][3] = 1;
      n[1] = 0;
      n[2] = 0;
      display ();
      return 0;
    }