#include #include #include double elapsed_time(struct timeval tp[2]) { return tp[1].tv_sec-tp[0].tv_sec+1e-6*(tp[1].tv_usec-tp[0].tv_usec); } void print_prims(int n, char *tab){ int n2=n*n, i; for(i=2; i 1) n = atol(argv[1]); if(argc > 2) d = 1; tab = (char *) malloc(sizeof(char)*n*n); gettimeofday(tp, 0); sieve(n, tab); gettimeofday(tp+1, 0); if(d) print_prims(n, tab); printf("%lf\n", elapsed_time(tp)); }