tros66e624a
make some variables static
+10 −7
1 file changed
- M src/main.c +10 −7
| @@ -5,10 +5,10 @@ | |||
| 5 | 5 | #include <time.h> | |
| 6 | 6 | // https://texteditor.com/multiline-text-art/ | |
| 7 | 7 | ||
| 8 | − | const int EASY_SCORE_DECREMENT = 10; | |
| 9 | − | const int MEDIUM_SCORE_DECREMENT = 20; | |
| 10 | − | const int LOWER = 1; | |
| 11 | − | const int UPPER = 4; | |
| 8 | + | static const int EASY_SCORE_DECREMENT = 10; | |
| 9 | + | static const int MEDIUM_SCORE_DECREMENT = 20; | |
| 10 | + | static const int LOWER = 1; | |
| 11 | + | static const int UPPER = 4; | |
| 12 | 12 | ||
| 13 | 13 | typedef enum Difficulty { | |
| 14 | 14 | Easy, | |
| @@ -18,9 +18,9 @@ typedef enum Difficulty { | |||
| 18 | 18 | ||
| 19 | 19 | int list[35]; | |
| 20 | 20 | ||
| 21 | − | int score = 100; | |
| 22 | − | int level = 1; | |
| 23 | − | int size = 5; | |
| 21 | + | static int score = 0; | |
| 22 | + | static int level = 1; | |
| 23 | + | static int size = 5; | |
| 24 | 24 | ||
| 25 | 25 | // Declaring Functions | |
| 26 | 26 | void decrement_score(Difficulty diff); | |
| @@ -120,6 +120,9 @@ Difficulty get_difficulty() { | |||
| 120 | 120 | case 3: | |
| 121 | 121 | difficulty = Hard; | |
| 122 | 122 | break; | |
| 123 | + | default: | |
| 124 | + | printf(COLOR_RED "Invalid Choice. Defaulting to Medium\n" COLOR_OFF); | |
| 125 | + | break; | |
| 123 | 126 | } | |
| 124 | 127 | return difficulty; | |
| 125 | 128 | } | |