What is the C equivalent for reinterpret_cast?

后端 未结 3 2103
[愿得一人]
[愿得一人] 2021-02-11 13:20

What is the C equivalent for the reinterpret_cast from C++?

3条回答
  •  你的背包
    2021-02-11 13:55

    C-style casts just look like type names in parenthesis:

    void *p = NULL;
    int i = (int)p; // now i is most likely 0
    

    Obviously there are better uses for casts than this, but that's the basic syntax.

提交回复
热议问题