summaryrefslogtreecommitdiff
path: root/3/part2.c
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2020-12-05 15:20:27 +0100
committerBond_009 <bond.009@outlook.com>2020-12-05 15:20:27 +0100
commit7a28ce25a69d3177879d134b87eeff5f754638b5 (patch)
treec6e7418f2d28607a2caf73a81197470ebcc37e7d /3/part2.c
parent4f3827b3165ec19abcd9e5a5892cf00c0db893ed (diff)
Remove shell overhead for benchmarking
Diffstat (limited to '3/part2.c')
-rw-r--r--3/part2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/3/part2.c b/3/part2.c
index 7362c12..29319b4 100644
--- a/3/part2.c
+++ b/3/part2.c
@@ -35,6 +35,7 @@ int count_trees(int inc_right, int inc_down, const char *filename)
int main(int argc, char *argv[])
{
- long mul = (long)count_trees(1, 1, argv[1]) * count_trees(3, 1, argv[1]) * count_trees(5, 1, argv[1]) * count_trees(7, 1, argv[1]) * count_trees(1, 2, argv[1]);
+ int arg = argv[argc - 1];
+ long mul = (long)count_trees(1, 1, arg) * count_trees(3, 1, arg) * count_trees(5, 1, arg) * count_trees(7, 1, arg) * count_trees(1, 2, arg);
printf("%li\n", mul);
}