Can someone please help me jog my memory? It's been a long time since I used C, but I had this problem once before. I figured it out then, but I've forgotten what I did to do so and now it's driving me crazy. Anyway, my problem is when using the same variable in a nested if else.
char choice;
blah
if(sentinel == -1)
{
blah
scanf("%c", &choice);
if(choice != 'y')
{
blah
}
here is the stickler
else
{
blah
scanf("%c", &choice);
switch(choice)
{
blah
}
All of this is inside the first if statment. My code does not do what I intended I guess because either choice still is clinging onto its first value or scanf has null in it or something. It must be scanf since the same thing happens even if I use another variable in the second scanf. Any ideas are greatly appreciated.
TIA