1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

initalization Query !

Discussion in 'C' started by Bhullarz, Apr 7, 2008.

  1. Bhullarz

    Bhullarz New Member

    Joined:
    Nov 15, 2006
    Messages:
    253
    Likes Received:
    13
    Trophy Points:
    0
    Occupation:
    System Manager
    Home Page:
    Code:
    #include<stdio.h>
    int main()
    {
    int i=(2,3);
    printf("%d",i);
    }
    
    output of the program would be:
    Code:
     3 
    i don't understand why it is 3 as far as i know one variable can be assigned one value at one time,but here we are assigning 2 values,but still this program is error/warning free and giving output.

    kindly explain the reason.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    Read about the comma operator and it will become clear to you
     
  3. Bhullarz

    Bhullarz New Member

    Joined:
    Nov 15, 2006
    Messages:
    253
    Likes Received:
    13
    Trophy Points:
    0
    Occupation:
    System Manager
    Home Page:
    Thank you. I wasn't aware of this operator.
     

Share This Page