puzzel
Results 1 to 3 of 3

Thread: puzzel

  1. #1
    Banned
    Join Date
    Dec 2004
    Posts
    8

    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.

  2. #2
    Senior Member
    Join Date
    Oct 2004
    Posts
    122
    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?
    nobody is perfect i am nobody

  3. #3
    Custom User
    Join Date
    Oct 2001
    Posts
    503
    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
  •  

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides