I wrote a program to solve one of the questions at the euler project ..

it asks to add all the primes under two million ..

I wrote a program and tried the answer .. got it wrong a few times .. rewrote the program and got it wrong a few more times ..

so Im thinking I may have the wrong data type I have used int .. long int and usigned int ..

hopefully someone can spot where Im going wrong and put me on the right track ..

anyway heres my code
Code:
/*   objective sum all primes under two million using sieve method */
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000000
int find_ans( unsigned int*fp ){
     unsigned int count,d = 0,sum = 0;

     for( count = 2; count < MAX; ++count ){
          if( *( fp + count ) == 1 ){
               ++d;
               sum = sum + count;
               printf("%i          %i\n",count,sum );
            }
     }
     printf("find_ans\n");
     printf("number of primes %li sum %li\n",d,sum );
}
int find_prime( unsigned int count, unsigned int *fp ){
//     printf("find_prime\n");
     unsigned int countR = 2 * count;

     for( countR; countR <= MAX; countR += count ){
         *( fp + countR ) = 0;
         }
}
int sieve( unsigned int *fp ){
     printf("sieve\n");
     unsigned int count;

     for( count = 2; count < MAX; ++count ){
          if( *( fp + count ) == 1 ){
               find_prime( count, fp );
          }
     }
     find_ans( fp );
}
int make_array( unsigned int *fp ){
     int count;

     printf("make_array\n");
     for( count = 0; count < MAX; count++ ){
          *( fp + count ) = 1;
     }
     sieve( fp );
}
int allocate_memory(){
     unsigned int *fp;

     printf("allocate_memory\n");

     fp = ( unsigned int *) malloc( MAX*sizeof( unsigned int ));
     if( fp == NULL ){
          fprintf(stderr, "out of memory\n");
          exit ( 1 );
          }
     make_array( fp);
     free( fp );
}
int main( int argc, char * argv[] ){
     allocate_memory();
     getchar();
     return( 0 );
}
any help appreciated .. thanks al.

ps not looking for the answer just hints on my programming ..