what is the output of the following C code and how does it work? -


#include<stdio.h>   void main()  {      while(1)      {          if(printf("%d",printf("%d")))              break;          else              continue;      }  } 

how possible have statement in if clause?

the output undefined values

how come statement in if clause?

printf returns number of characters printed. non-zero value in c can evaluated true, can use return value test if condition.

beside all, program invokes undefined behavior because not passing argument %d in inner printf.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

android - IBM Worklight 6.1 [Application Error] There was a network error (file:///android_asset/www/index.html) -