hi.
Why is it that zero (0) is output after running
1 2 3 4 5 6 7 8
|
.........
k=1;
i=1;
for(;i<201;++i)
for(;k<201;++k)
A[i][k]=1000000;
cout<<A[112][23];
...................
|
Last edited on
At line 5, change for(;k <= 201
to for(k = 1;k <= 201
Now the code should work, see explanation below. Sorry for what I have said earlier.
Last edited on
Why just once?
Weren't they initialized outside the loop?
Last edited on
Think about what value k will have at the end of the first time your inner loop runs (when i is 1).
Think about what value k will have at the start of the second time your inner loop runs (when i is 2).
Think about how many times your inner loop will run when i is 2.
Last edited on