Why does sizeof(x++) not increment x?

前端 未结 9 1668
清酒与你
清酒与你 2020-11-22 09:36

Here is the code compiled in dev c++ windows:

#include 

int main() {
    int x = 5;
    printf(\"%d and \", sizeof(x++)); // note 1
    print         


        
9条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 10:19

    sizeof() operator gives size of the data-type only, it does not evaluate inner elements.

提交回复
热议问题