What is the C equivalent for reinterpret_cast?

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

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

3条回答
  •  鱼传尺愫
    2021-02-11 14:18

    int *foo;
    float *bar;
    
    // c++ style:
    foo = reinterpret_cast< int * >(bar);
    
    // c style:
    foo = (int *)(bar);
    

提交回复
热议问题