Consider the following code
#include <stdio.h> int main() // w w w . j av a 2 s . co m { int a,b; a = 5; b = -3; if(a==b); printf("%d equals %d\n",a,b); return(0); }
The trailing semicolon after if statement tells the program that the if statement has nothing to do when the condition is true.
That's because a single semicolon is a complete statement in C, albeit a null statement.
if(condition)
;