hello everyone ...

i have this program .. i tried to make it work to give me this result
output:
Code:
input array {1,3,5,1,1,8,6,6,1,3,2,1,6,8,8}
[0]
[1] *****
[2]*
[3]**
[4]
[5]*
[6]***
[7]
[8]***
[9]

this is my code
Code:

Code:

int main ( void )
{
   int i, n,j;
   
   printf ("How many values in your data set? ");
   scanf ("%d", &n);

   int list[n];
   for (i=0; i < n; i++) {
      printf ("Enter a value: ");
      scanf ("%d", &list[i]);
      
   }

   
   int hist[10];    


   
   printHistogram ( hist, 10);
  
   return 0;
}

void printHistogram ( int *list, int n )
{
    int i, j;

   for (i=0; i < n; i++) {
      printf ("[%d] ", i);
      for (j = 1; j <= list[i]; j++)
         printf ("*");
      printf("\n");
    }
   
}

instead i'm having asterisks at the end of the output

can you please help me ....
thank you ..