c - Confusion about the output -


#include<stdio.h> int main(void) {     int i=1,j=-1;     if((printf("%d",i))<(printf("%d",j)))         printf("%d",i);     else          printf("%d",j);     return 0; } 

as printf() returns number of characters printed, condition if(1<1) false if part executed , output 1 -1 1. why happening?

i think rather obvious: '1' 1 character, '-1' two. 1 less two.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -