c - Why does this print 1? -
#include <stdio.h> int main() { int var=0; for(; var++; printf("%d",var)); printf("%d", var); } please explain me c code. how output 1?
you might confused because of wrong code indentation. code is:
for(; var++; printf("%d",var)) ; printf("%d", var); so output of second printf. var initialized 0 , var++ (the for-condition) executed, end var==1.
Comments
Post a Comment