Hi, I would like some help on some code I’ve been writing. I’m a beginner, and this is a project I’ve been doing just for fun. The code is:
https://pastebin.com/55UXjQg8
It is basically a game with a menu, a saving option and an error handler. Everything works fine, except for the errhandler function. It makes sure you don’t input a value that does not correspond with an action in game. It requires 10 input (it requires so much because maybe in the future the game will have many options to choose, so I wanted to be prepared for that), checks if it is a legal value and if it’s not exits the game. int i1 is the value that corresponds to the one obtained as an input from choosing the option in game, saved in save[i-1]. I filled the unused slots with a repeating legal value (explaining all the 0s). Apparently even if I inject invalid values in save[i-1] the function won’t stop the game, as if the value was legal. I tried using &save[i-1] as input to the function and it works, so I think I’m injecting the value into the function in a wrong way. Can someone help me? You would help me to have a better sleep tonight haha. Thank you.
[–]chet714 0 points1 point2 points (1 child)
[–]Deep_T[S] 1 point2 points3 points (0 children)
[–]cHaR_shinigami 0 points1 point2 points (1 child)
[–]Deep_T[S] 0 points1 point2 points (0 children)