what is typeof((c) + 1) in C

后端 未结 7 2112
梦谈多话
梦谈多话 2020-12-23 14:09

I came across an expression in C like

typeof((c) + 1) _tmp = c;

What exactly does this mean?

Thanks for the reply.

Just on

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-23 14:22

    Typeof returns a type, and is evaluated at compile time.

    The whole statement means declare a variable tmp with the same type as c (usually).

    It might declare a related or different type, since the type of c+1 can be different to c. (this is more likely in c++).

提交回复
热议问题