Machine Organization I
V22.0201 - Spring 2009
Sieve of Erasthosenes Prime
Number Generator Redux
Redo the Sieve of Erasthosenes Prime Number Generator you created, but
this time code it in C using the GCC compiler (which includes the XCode compiler
on the Mac).
Here are some new considerations:
Limit your range to numbers less than some constant value, say, max=5000.
Error check your input against this value.
Unless you do the Extra Credit (below), your array this time will be
integers and not bits. (It is possible to do bit manipulation in C, but
Declare an array of max in main and initialize it. A pointer to the array
will be passed to the various functions in your program.
Access the array using ONLY pointers - Don't use subscripts!
As before, input the number N, and output all the prime numbers less than
or equal to N and the count of those prime numbers
Make certain that your program is constructed in a 'top-down' manner, and
that it has been divided into several, reasonably chosen functions
Make certain that your program is well commented
Extra Credit (2 points): As in the Assembler version, create an array of
BYTES but store the numbers as individual BITS. Note that the array should
still only be accessed using pointers! (Clearly
comment your program at the top that it is intended for extra credit.)