Reputation: 61
Whenever I run this (part of a much larger file), when I get asked for inputs, if they are not numbers (letters or words) the code seems to loop and I'm not sure why.
while(rembox>=1){
printf("%c> ", p );
s=scanf("%d %d %c",&r , &k, &orin);
if (r = 5 || k =10){
*statement*
rembox --;
}
else{
rembox --;
continue;
}
Upvotes: 0
Views: 201
Reputation: 2206
At this line :
if (r = 5 || k =10){
You are assigning values 5 and 10 to r and k variables.
What you wanted to do :
if (r == 5 || k ==10){
Upvotes: 3