I get a really strange error when I try to run a very simple program : "Unhandled exception at 0x0F29F365 (msvcr120d.dll) in HW2_1_JM.exe: 0xC0000005: Access violation reading location 0xFFFFFFFF."

This is my first post, and that is the error I consistently get when I attempt to run this program. I'm new to programming, so I'm sorry for my code quality. My mom couldn't figure out what it was. When it's not throwing this error, it's simply pausing endlessly before the while. We think the error is with "int d" because when we tried to print both n and d we get the error again after printing n. 
  

      int main()
    {
       int a[10];
       puts("Please input a value: \n");
       int n;
       scanf("%i", &n);
       printf("\n you chose: %i\n", n);
       puts("Please input a base value, between 1 and 11: \n");
       int d;
       scanf("%i", &d);
    
       while (!(n = -1));
       {
          int q = n;
          int k = 0;
          printf(q);
          while (q != 0);
          {
             a[k] = (q % d);
             q = q / d;
             printf(q);
             k++;
          }
          for (int j = 0; j < 11; j++)
          {
             printf("Element [%d] = %d \n", j, a[j]);
          }
          puts("Please input a value: \n");
          scanf("%i", &n);
          printf("\n you chose: %i\n", n);
          puts("Please input a base value, between 1 and 11: \n");
          scanf("%i", &d);
       }
       system("pause");
       return 0;
    }