This part:
while(GetExitValue() == 'y' || 'Y' ); // **Problem here!!**
which you've correctly spotted, is probably not doing what you meant. This always is "true" because 'Y' (which is not 0 in ASCII) is always "true".
You literally have this in your code: while (condition || 1)
which can be useful, but not in this case.
You probably mean this:
.
.
// run GetExitValue() only once...
char gev = GetExitValue();
}
while(gev == 'y' || gev == 'Y' );
And I'll just point out that you can do something like:
.
.
}
while(GetExitValue()); // no need to store value!
if only you'd change GetExitValue()
to return 0 when user does not want it to run again:
char GetExitValue(){
char exit_value;
scanf(" %c", &exit_value);
while(exit_value != 'y' && exit_value != 'n' && exit_value != 'Y' && exit_value != 'N'){
printf("Value incorrect. insert y or n!!\n");
scanf(" %c", &exit_value);
}
return exit_value == 'Y' || exit_value == 'y'; //evaluates to 1 if true
}
It will probably be cleaner, and you can change it's name to shouldRunAgain()
which to my personal taste is more informative :)