example for if statement with semicolon in c:
Find the output of this program?
int i= 10;
compile time error
it prints 10. This is an example of some simple mistakes done by programmers. Here programmer is putting semicolon after if condition, which means if condition is true execute ";" (do nothing). so next printf statement won't come under if condition at all. so that printf will execute all the time, irrespective of if condition is true or false.
Back To Top