How the if condition works here?????????
Code:void main() { int i; char a[]="\0"; if(printf("%s\n",a)) printf("Ok here \n"); else printf("Forget it\n"); }
How the if condition works here?????????
Code:void main() { int i; char a[]="\0"; if(printf("%s\n",a)) printf("Ok here \n"); else printf("Forget it\n"); }
are you testing any condition here? i think you should go and review some example snippets and just google usage / construction of if statements.
Last edited by rogster001; 09-02-2009 at 03:06 AM.
printf returns the number of characters printed. Since it prints '\n', the result is one and the condition is always true.
I might be wrong.
Quoted more than 1000 times (I hope).Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.