How to convert int* to int

前端 未结 7 992
无人共我
无人共我 2020-12-30 01:29

Given a pointer to int, how can I obtain the actual int?

I don\'t know if this is possible or not, but can someone please advise me?

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-30 01:35

    use the dereference operator * e.g

    void do_something(int *j) {
        int k = *j; //assign the value j is pointing to , to k
        ...
    }
    

提交回复
热议问题