-
puzzel
Hello everyone here is a programming puzzel for all ,
Take a look at code segment below
----------------------------------------------------------
//compiled with vc++
main()
{
int b=(printf ("k") , printf ("ku"));
printf("%d",b);
}
-----------------------------------------------------------
Wait plz don't run this code Just make a guess .............What will be the out put of this program?
What the hell happened to b?
I just can' t get the concept.
-
Try answering your question yourself.
Replace int b=(printf ("k") , printf ("ku")); with int b=(printf ("k") , printf ("ku"),printf ("kut"));
then run.
Now replace int b=(printf ("k") , printf ("ku"),printf ("kut")); with int b=(printf ("k") , printf ("ku"),printf ("kut"),printf("kutf"));
notice those two return values ?
Do you get the logic?
-
The following link should help you, and also remember that printf and all the c print functions return the number of characters printed on successful completion. Here's the link:
http://www.ssec.wisc.edu/~dglo/c_class/comma.html
ac