matthewmpp@annrogers:~/Programming/C.progs/Personal$ cat prime4.c
/*
* File: main.c
* Author: matthewmpp
*
* Created on November 7, 2010, 2:16 PM
*/
#include
What happens is a division by zero. You only initialise the first three entries of primes_pf
, but iterate over all of them (actually, your loop runs even one past the last entry; use i < 100
instead of i <= 100
to fix this). For all but the first three entries, you divide by some unitialised quantity, and one of the entries apparently happens to be zero. Don't use unitialised values.