What happens if statement is closed by semicolon like if(); in c language | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What happens if statement is closed by semicolon like if(); in c language

I check it it stop after the semicolon.

7th Apr 2019, 3:40 PM
Gurunam Singh panwar
Gurunam Singh panwar - avatar
1 Answer
+ 3
if(condition); { puts("yay"); } is the same as if(condition) { // empty expression, do nothing } { // doesn't belong to the if clause, always executed puts("yay"); }
7th Apr 2019, 3:55 PM
Anna
Anna - avatar