int prime (int poss_prime);
int main() {
int poss_prime;
for (poss_prime = 2; poss_prime <= MAX_INT; poss_prime++) {
if (prime (poss_prime)) {
printf("%d ", poss_prime);
}
}
printf("\n\n");
return 0;
}
int prime (int poss_prime) {
int poss_factor;
for (poss_factor = 2; poss_factor <= poss_prime/2; poss_factor++) {
if (poss_prime % poss_factor == 0) {
return 0;
}
}
return 1;
}
我不明白为什么函数可以作为if语句中的条件,以及为什么poss_prime在for循环条件中被二除。谢谢你。