How do I cast a pointer to an int

后端 未结 5 2243
一向
一向 2021-02-13 21:54

I\'m trying to store the value of an address in a non pointer int variable, when I try to convert it I get the compile error \"invalid conversion from \'int*\' to \'int\'\" this

5条回答
  •  没有蜡笔的小新
    2021-02-13 22:39

    Why are you trying to do that, anyway you just need to cast, for C code :

    thatvalue = (int)ip;
    

    If your writing C++ code, it is better to use reinterpret_cast

提交回复
热议问题