1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

solve it and tell me how it works?

Discussion in 'C' started by Ankur Kamboj, Aug 1, 2011.

  1. Ankur Kamboj

    Ankur Kamboj New Member

    Joined:
    Jun 19, 2011
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    main(){
    int i = 10, j =20;
    j = i ,j?(i,j)?i :j:j;
    printf(“%d\n%d”,i,j);
    }

    the answer is 10 10
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,285
    Likes Received:
    364
    Trophy Points:
    83
    See the use of comma operator and it will be clear why you have that as a answer.
     
  3. Ankur Kamboj

    Ankur Kamboj New Member

    Joined:
    Jun 19, 2011
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    thanks alot...
     

Share This Page