int main() { int sieve[SIZE]; /* the sieve */ int *sp; /* point to access sieve */ int number;/* number we are comupting */ int total = 1;/* count the total number of primes */ /* ** Set the entire sieve to true */ for(sp = sieve; sp < &sieve[SIZE];) *sp++ = TRUE; /* ** Process each number from 3 to as many ** as the sieve holds. */ for(number = 3; number += 2;)/*the loop is terminated from inside*/ { /* ** Set the point to the proper element in the sieve ** and stop the loop if we've gone too far */ sp = &sieve[0] + (number - 3) / 2; if(sp > &sieve[SIZE]) break; /* ** Now adwance the point by multiple of the number ** and set each subsequent entry false */ while( sp += number,sp < &sieve[SIZE]) *sp = FALSE; } /* ** Now we go through the entire sieve and print the numbers ** corresponding to the location that remain TRUE */ printf("2\n"); for(number = 3,sp = &sieve[0]; sp < &sieve[SIZE] ; number += 2,sp++) { if(*sp) { printf("%d\n",number); total++; } } printf("the total number of primes is %d\n",total); system("pause"); return 0; } 而且为什么把筛选数组改为char之后反倒不能找出更多的质数了呢? [解决办法] 大师经常灌水不用理会,我在4楼帮你找到问题点了。