value of char variable with loops

This is a discussion on value of char variable with loops within the C Programming forums, part of the General Programming Boards category; the first time around, the program works as expected. the integer x is set to 0 when a response is ...

value of char variable with loops

the first time around, the program works as expected. the integer x is set to 0 when a response is given other than 'y,Y,n,or N' so that the function will repeat. the second time around, even if 'y,Y,n,or N' is given as the reponse, the program seems to think that answer contains something else...perhaps the previous input? do i need to initialize answer each time around? thanks for the help if u can..extremely new here

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell