THANK YOU ALL!!! - what errors should I check for and handle?

Thank you all for your kind, patient and educative responses when I obnoxiously post amateur questions! 💙 While I cannot make any promises because of how my brain works, I am almost ready to continue reading *The C Programming Language, 2nd Edition”. I just want to experiment a little bit with error handling, specifially how to handle wrong input (char VS. int, etc.) and also to learn to indentify code that runs the risk of overflow/underflow.

Question: what errors do you recommend checking for and handling?

Meanwhile, thank you all! 🥰

#include <stdio.h> //Function declarations int newPin(); int checkPin(int i); //Program that prompts for, verifies and saves pins temporarily into an array int main() { //New pin int pin = 0; //History int history[10] = {0,0,0,0,0,0,0,0,0,0}; int history_limit = 10; int history_index = 0; printf("Hello there! What would you like to do? (V)iew your saved pins, (S)ave a new pin or (E)xit: "); int choice = 0; while ((choice = getchar()) != EOF) { switch (choice) { case ('V'): { //Display saved pins printf("\nYour saved pins are:\n\n"); for (int i = 0; i < history_limit; i++) printf("%d\n", history[i]); printf("\nWhat would you like to do next? (V)iew your saved pins, (S)ave a new pin or (E)xit: "); break; } case('S'): { //Prompt for and verify newly entered pin pin = newPin(); if (checkPin(pin) == pin) { history[history_index] = pin; history_index++; if (history_index >= history_limit) history_index = 0; } break; } case ('E'): goto EXIT; //Terminate program } } EXIT: printf("\nGoodbye!\n"); return 0; } //Function definitions //Prompt user to enter a new pin int newPin() { int pin = 0; printf("This enter your pin: "); scanf("%d", &pin); getchar(); return pin; } //Verify newly entered pin int checkPin (int i) { int check = 0; printf("Confirm your new pin: "); while((scanf("%d", &check)) != EOF) { if (check != i) printf("Mismatch! Confirm your new pin: "); else if (check == i) { printf("Success! Your new pin is %d. What would you like to do next? (V)iew your saved pins, (S)ave a new pin or (E)xit: ", i); goto EXIT; } } EXIT: return i; } //TODO //Error handling (overflow, input data type, other?)
'So much is being allowed to spoil': Country food in Nunavut faces distribution challenges
Limited freezer space at airports, broken community freezers, and delays in cargo handling lead to expired food, according to one researcher.
https://www.cbc.ca/news/canada/north/so-much-is-being-allowed-to-spoil-country-food-in-nunavut-faces-distribution-challenges-9.7191869?cmp=rss
美國海關與邊境保護局(CBP)於當地時間4月20日上午8時起,分階段處理關稅退還手續。當局指,進口商及代理商可透過海關及邊境保護局相關網上系統申
https://www.hk01.com/即時國際/60341856/美國4月20日起分階段處理關稅退還手續-預計須退還1萬億元
Orbit is filling up fast. Now comes the awkward bit: pre-empting and handling a crisis.
https://atlas.whatip.xyz/post.php?slug=orbit-is-filling-up-fast-now-comes-the-awkward-bit-pre-empting-and-handling-a-crisis
<p>Earth’s orbit is “on track for a catastrophe.” That was the rather alarming prediction of the
#handling #filling #awkward #empting
Orbit is filling up fast. Now comes the awkward bit: pre-empting and handling a crisis.

Earth’s orbit is “on track for a catastrophe.” That was the rather alarming prediction of the authors of a recent piece published in The Conversation. As the argument goes, orbit is filling up fast, a...

Ett konstruktivt program för goda liv – intervju med Per Herngren om postprotest och Buen Vivir

Vad händer när vi bygger det samhälle vi vill ha – här och nu? Per Herngren om Buen Vivir, ickevåld och performativ samhällsförändring. Lär dig hur gemenskaper skapar hållbara lösningar. Läs mer nu!

https://www.godaliv.se/goda-liv/ett-konstruktivt-program-for-goda-liv-intervju-med-per-herngren-om-postprotest-och-buen-vivir/

@veganguide

Kære kammerater,

Gå foran med et eksempel! Vi mangler et brunchhold (hver fjerde søndag). Brunchen må godt være vegansk og I får al den hjælp, I behøver for at komme i gang.

Glæder os til at høre fra jer!

#handling-gir-forvandling!

HYBE's Handling Of Another Group's Solo Activities Versus Heeseung Ignites Heated Debate - KpopNewsHub – Latest K-Pop News, Idols & Korean Entertainment

But is it as simple as fans think?

Kpop News Hub
Is BELIFT LAB Handling Heeseung’s Exit From ENHYPEN Well? - KpopNewsHub – Latest K-Pop News, Idols & Korean Entertainment

Reactions have been mixed.

Kpop News Hub
POLL: Is BELIFT LAB Handling Heeseung’s Exit From ENHYPEN Well? Vote Now! - KpopNewsHub – Latest K-Pop News, Idols & Korean Entertainment

Why or why not? Cast your vote in this new poll.

Kpop News Hub