c-first-steps

a C playground
Index Commits Files Refs README
commit cba672985cd310b4da6a5fc4cd800377c4a37756
parent ef1437fda61f5db78d5d598a1163f7e96c6e00c6
Author: Martin J. Klöckner <martin.cachari@gmail.com>
Date:   Sun,  8 Nov 2020 00:33:07 -0300

Update: Improve source code

Diffstat:
Msrc/dc.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/dc.c b/src/dc.c
@@ -41,6 +41,7 @@ void cursor() {
     printf(">> ");
 }
 
+
 int main(void)
 {
     char buffer[MAX_INP_LEN];
@@ -53,7 +54,7 @@ int main(void)
     if(c == FAHRENHEIT) {
         title(FAHRENHEIT);
         while(fgets(buffer, MAX_INP_LEN, stdin) != NULL) {
-            i = atoi(s);
+            i = atoi(buffer);
             res = ftoc(i);
             printf("%.0f°F = %.2f°C\n", i, res);
             cursor();
@@ -61,7 +62,7 @@ int main(void)
     } else if(c == CELSIUS) {
         title(CELSIUS);
         while(fgets(buffer, MAX_INP_LEN, stdin) != NULL) {
-            i = atoi(s);
+            i = atoi(buffer);
             res = ctof(i);
             printf("%.0f°C = %.2f°F\n", i, res);
             cursor();