|
-
January 15th, 2005, 06:09 PM
#1
Banned
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.
-
January 15th, 2005, 06:14 PM
#2
Senior Member
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?
-
January 15th, 2005, 07:47 PM
#3
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|