Russ Whitaker wrote:
1) 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.
2) the value of h can exceed the array size
Only if more than 50 primes <= 100 are found which does not usually happen. ;-)
3) 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 -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/ GPC To-Do list, latest features, fixed bugs: http://agnes.dida.physik.uni-essen.de/~gnu-pascal/todo.html
participants (1)
-
Frank Heckenbach