I use ch to try to create a for loop for an array that will produce twice the value of the array right in front of it, but I keep getting the same error message. Oh, I also create this in ch, so I'm not sure if my error is related to this or if my code is just messed up. Here is my code so far, and I feel as if it should work, but I know something is missing:
ch> int a[10]
ch> int i
ch> for (i=1; i<10; i++)\
ch> a[i] = 2 * a[i-1]
this is my code and i expect this output
ch> a[9]
512
but instead i get
ch> a[9]
0
I would like to be able to print all 9 values as a list side by side, the right is justified in a for loop, i.e.
0 1
1 2
2 4
3 8
4 16
5 32
And when I try to justify it correctly, like printf ("% i% -5i", i, a [i]);
I get an error message Warning: index value 10 is greater than the upper limit of 9
10 512
ti, .