Russ Whitaker wrote:
- p[h] defaults to zero
I don't think that's the problem since h < j and p [j] is initialized before each increment of j.
- the value of h can exceed the array size
Only if more than 50 primes <= 100 are found which does not usually happen. ;-)
In BP 7, If you modify the index inside a for-loop the results are undefined After you exit the for-loop the index is undefined unless you exited with a goto
in C, You can mdify the index inside the for-loop The value of the index is visable after you exit the loop (ref K&R 2nd Ed, p61)
Yes, because there does not even have to be a loop counter in a C for loop (or there can be several counters, or anything). C for loops are really only syntactic sugar for while loops...
So what does the Pascal specs say?
Like BP (in this case).
(I wish I had a copy of each)
You can find them at ftp://ftp.digital.com/pub/DEC/Pascal/ (but you need a lot of patience to make sense of their formal language)...
Frank