From: G DOT DegliEsposti AT ads DOT it To: djgpp AT delorie DOT com Message-ID: Date: Wed, 4 Mar 1998 12:41:27 +0100 Subject: Re: Re: Loop help Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Precedence: bulk > I know this isn't a DJGPP question but I dunno the C group. IIRC there are two: comp.lang.c and comp.lang.c.moderated > char word[25]="monkey"; /* The actual word */ > int length=6; /* The length of the word */ > int counter; /* The counter */ > char guess; /* Holds the guesses */ [...] > printf("\nGuess? "); > scanf("%c", guess); scanf expects the address of the variable, so you have to write: &guess don't worry if you don't see the prompt before you type in the guess, this is because stdout is line buffered, you can use fflush(stdout) to force output of the buffer. > for(counter=length;counter>0;counter--) > { > if(guess==word[counter]) There is another problem you didn't notice here: string in C begin at index 0, while your code assumes 1. This code will check value word[6] which should be the '\0' string terminator and it will not check word[0]. Use word[counter -1] or better loop from lenght -1 down to 0 ciao Giacomo