From de027fe4ff28aa30ffc61e8df0be368c4dfe0b8f Mon Sep 17 00:00:00 2001 From: Krishna Vedala Date: Wed, 8 Apr 2020 09:46:44 -0400 Subject: [PATCH] using long long int for pritf compatibility --- project_euler/Problem 08/sol1.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/project_euler/Problem 08/sol1.c b/project_euler/Problem 08/sol1.c index 1c57045e..4404549c 100644 --- a/project_euler/Problem 08/sol1.c +++ b/project_euler/Problem 08/sol1.c @@ -1,13 +1,12 @@ #include -#include #include -int64_t get_product(FILE *fp, long start_pos, int num_digits) +long long int get_product(FILE *fp, long start_pos, int num_digits) { - char ch = ' '; /* temporary variable to store character read from file */ - uint8_t num = 0; /* temporary variable to store digit read */ - int64_t prod = 1; /* product accumulator */ - int count = 0; /* we use this variable to count number of bytes of file read */ + char ch = ' '; /* temporary variable to store character read from file */ + uint8_t num = 0; /* temporary variable to store digit read */ + long long int prod = 1; /* product accumulator */ + int count = 0; /* we use this variable to count number of bytes of file read */ /* accumulate product for num_digits */ for (int i = 0; i < num_digits; i++, count++) @@ -49,7 +48,7 @@ int main(int argc, char *argv[]) { int position = 0; int num_digits = 4; - int64_t prod, max_prod = 0; + long long int prod, max_prod = 0; /* if second command-line argument is ge=iven, * use it as the number of digits to compute