Problem 10 solution
More...
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
|
int | main (int argc, char *argv[]) |
| Main function. More...
|
|
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Main function.
21 sieve =
calloc(n,
sizeof(*sieve));
24 perror(
"Unable to allocate memory!");
33 for (
long i = 2; i < sqrtl(n); i++)
39 for (
long j = i * i; j < n + 1; j += i)
47 for (
long i = sqrtl(n) + 1; i < n; i++)
53 printf(
"%ld: %lld\n", n, sum);
#define free(ptr)
This macro replace the standard free function with free_dbg.
Definition: malloc_dbg.h:26
#define calloc(elemCount, elemSize)
This macro replace the standard calloc function with calloc_dbg.
Definition: malloc_dbg.h:22