Here I have a code that should print "Error" after the first sequence of the loop, since according to my previous question Print an "Error" statement after do-while loop in C It would only read the first condition of the loop due to "short-cicuiting" and would only be executed after the first sequence of the loop... After solving that I still can't display "Error!", so I tried adding && getch()
that gave me an output of
Error!
Now that I have 3(Multiple) conditions that caused the "Error!" to be executed within the first sequence, I want to know how does C respond to my multiple conditions, that might help me to solve the error.
My code:
#include <stdio.h>
#include <conio.h>
void main(){
int inp;
while(inp<10 && printf("Error") && getch()){
clrscr();
printf("Enter Number > 10: ");
scanf("%d",&inp);
}
printf("Right Answer!");
getch();
}