squiggle.c

Self-contained Monte Carlo estimation in C99
Log | Files | Refs | README

commit f52477731328919e33abb29d2094640507a3fb24
parent b548d50debb4fe71b61990c3d6a1562fe21f9394
Author: NunoSempere <nuno.sempere@protonmail.com>
Date:   Tue, 30 Jan 2024 16:27:17 +0100

switch to using calloc (initializes memory to zero)

Diffstat:
Msquiggle_more.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/squiggle_more.c b/squiggle_more.c @@ -225,7 +225,7 @@ void array_print_histogram(double* xs, int n_samples, int n_bins) { return; } - int *bins = (int*) malloc((size_t)n_bins * sizeof(int)); + int *bins = (int*) calloc((size_t)n_bins, sizeof(int)); if (bins == NULL) { fprintf(stderr, "Memory allocation for bins failed.\n"); return;