i'm trying to output a number of "*" for the number it corresponds to in an array e.g
Code:
```array[3]={1,2,3};
output:
1 |*
2 |**
3 |***```
ii'm getting a weird output 'm not sure but i think the error is here
Code:
`for(z_count=1; z_count<=nwords[y_count]; z_count++)`
here's my code:
Code:
```#include <stdio.h>
int main(void){
int nwords[10]={1,2,3,4,5,0,0,0,0,0};
int c, max, x, y_count, z_count;

c = max = x = y_count = z_count = 0;

for(x=1; x<=10; x++){
printf("%3d |",x);

//  for(y_count=0; y_count<10; y_count++){
for(z_count=1; z_count<=nwords[y_count]; z_count++){
printf("*");

}
// }
printf("\n    |");
printf("\n");
}

getch();
return 0;
}```

2. The inner loop needs to to make use of variable x, rather than y_count.

3. it works when i used x like this
Code:
`for(z_count=1; z_count<=nwords[x-1]; z_count++)`
but now i don't understand why it works with x-1 and not y_count because there the same in value

4. The outer loop is iterating over x. So, x changes with each iteration of the outer loop. The value of y_count is always zero.

5. ohhhhh i see thanks