Why doesn't a+++++b work?

前端 未结 9 1127
悲&欢浪女
悲&欢浪女 2020-11-22 06:26
int main ()
{
   int a = 5,b = 2;
   printf(\"%d\",a+++++b);
   return 0;
}

This code gives the following error:

error: lval

9条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-22 07:19

    printf("%d",a+++++b); is interpreted as (a++)++ + b according to the Maximal Munch Rule!.

    ++ (postfix) doesn't evaluate to an lvalue but it requires its operand to be an lvalue.

    ! 6.4/4 says the next preprocessing token is the longest sequence of characters that could constitute a preprocessing token"

提交回复
热议问题