Confusion with post increment and logical operator?

前端 未结 3 1341
误落风尘
误落风尘 2021-01-17 05:01
    #include 
    #include 

    main()
    {
         int i=-1, j=-1, k=0, l=2,m;
         m = i++&&j++&&k++||l++;
           


        
3条回答
  •  无人共我
    2021-01-17 06:03

    use this rules:

    i++ =post increments the value of i, k++ =post increments the value of k, l++ =post increments the value of l, j++ =post increments the value of j

    && - if values compared are both nonzero true(1) otherwise false(0)

    || - if values compared are both zero false(0) otherwise true(1)

    then apply towards expression m (also read on operator precedence in c)

提交回复
热议问题