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 -

google shop client API returns 400 bad request error while adding an item -