I am writing C code, in which I am analyzing some data. I have set the program to handle only 100 data inputs. When it has more than 100 inputs, it is giving a segmentation fault. I want to create a way so that when the number of inputs is above 100 the user will be warned and the program will terminate. I know how to do it from the main function by simply return 0
, however I am multiple function calls away from main and it is difficult to do that even a return 0
in this function will keep it looping.
Is there any immediate way to terminate the entire program without being in main?