I just couldn't work out how to use a loop for this situation.
I have this:
void exitquestion()
{
char exitquestion;
printf("\n\nDo you wanna quit?");
Type: Posts; User: jim.rattlehead
I just couldn't work out how to use a loop for this situation.
I have this:
void exitquestion()
{
char exitquestion;
printf("\n\nDo you wanna quit?");
I tried writing it as a while loop but I couldn't work out how to make it work like the above if statements should.
ie. Do you want to quit? Y/ N
N then go back to main, repeat the program...
I have tried rewriting it several times, and still the same problem occurs. Here is my latest attempt:
exitfunction()
{
char exitquestion;
printf("\n\nDo you wanna quit?");
exitquestion =...
Hmm I see. So for a implementation like the above it is always best to just use a char variable and not an array. Although either way it doesn't seem to be changing the behaviour of the function.
...
Wow speedy reply! So an array of char[1] is different to a variable of char? Didn't realise that. I now have this, which is similair to my original code:
exitfunction()
{
char...
Thanks for the help everyone, have tried this:
exitfunction()
{
char exitquestion; /* Local variable for storing question response about quitting. */
printf("\n\nAre You Sure You...
Hi there, I am new to C and I having trouble with this if statement which is called by the main function when the user requests to quit:
exitfunction()
{
char exitquestion[1]; /* Local...